Skip to content
Latchkey

How to Set a Step Output in GitHub Actions

A step output is the canonical way to hand a single value to a later step in the same job.

Give the step an id, append name=value to $GITHUB_OUTPUT, then read steps.<id>.outputs.<name> downstream.

Steps

  • Add an id: to the step that computes the value.
  • Append name=value to $GITHUB_OUTPUT.
  • Reference ${{ steps.<id>.outputs.<name> }} in later steps.

Workflow

.github/workflows/ci.yml
steps:
  - id: vars
    run: |
      echo "tag=$(git describe --tags --always)" >> "$GITHUB_OUTPUT"
  - run: docker build -t myapp:${{ steps.vars.outputs.tag }} .

Gotchas

  • The legacy ::set-output command is removed; use $GITHUB_OUTPUT.
  • To cross a job boundary, promote the step output to a job outputs: entry.

Related guides

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