Skip to content
Latchkey

How to Reference a Reusable Workflow Output in GitHub Actions

A reusable workflow exposes values through on.workflow_call.outputs, and the caller reads them from the calling job context.

Declare on.workflow_call.outputs mapped to a job output inside the reusable file. The caller then reads needs.<call-job>.outputs.<name>.

Steps

  • Map a job output to a workflow_call.outputs entry in the reusable file.
  • Call the workflow with uses: and give the call job an id.
  • Read needs.<job>.outputs.<name> in a downstream caller job.

Reusable workflow

.github/workflows/build.yml
on:
  workflow_call:
    outputs:
      image-tag:
        value: ${{ jobs.build.outputs.tag }}
jobs:
  build:
    runs-on: ubuntu-latest
    outputs:
      tag: ${{ steps.meta.outputs.tag }}
    steps:
      - id: meta
        run: echo "tag=sha-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"

Gotchas

  • The workflow_call.outputs.value must point at a real job output, not a step output directly.
  • The caller reads the output via needs, so it must needs: the call job.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →