github_output not working in github actions
Fixes the deprecated set-output command and the GITHUB_OUTPUT file workflow. Use when steps cannot pass outputs to later steps, when you see the set-output deprecation warning, or when outputs come through empty. Not for general workflow syntax or artifact passing.
TL;DR
If githuboutput is not working, you are almost certainly still using the deprecated set-output command, which GitHub disabled. The fix is to write outputs to the GITHUBOUTPUT file instead: echo "name=value" >> "$GITHUB_OUTPUT". Check the step for the old syntax first, then verify the output name matches exactly what the consuming step references, including case.
The query
github_output not working in github actionsUse this when
- A step's outputs are empty in later steps
- You see a deprecation warning about set-output
- Migrating old workflows to the GITHUB_OUTPUT file
- Outputs work locally in act but not on GitHub
Not for when
- General workflow YAML syntax errors
- Passing files between jobs (use artifacts)
- Secrets not available to steps (different issue)
Steps
Step 1: Check for the deprecated set-output command
Search the workflow for set-output. GitHub removed it; any step still using it silently produces no output. This is the cause in the large majority of cases. Expected output: the old command found and identified, or ruled out.
Step 2: Switch to the GITHUB_OUTPUT file
Replace the old command with a write to the GITHUBOUTPUT environment file: echo "myoutput=myvalue" >> "$GITHUBOUTPUT". Each output is one line; values with newlines need the heredoc delimiter form. Expected output: the step writes its outputs to the file GitHub actually reads.
Step 3: Verify output names match exactly
The consuming step references steps.[id].outputs.[name]. Names are case-sensitive and must match the id: field of the producing step. A typo here produces an empty string with no error, which looks like github_output not working. Expected output: producer id, output name, and consumer reference all identical.
Step 4: Check the step actually ran
If the producing step was skipped (an if: condition evaluated false), its outputs are empty. Check the step's conclusion in the run log before debugging the output mechanism. Expected output: the producing step shows as completed successfully, not skipped.
Step 5: Test multiline outputs with delimiters
For values containing newlines, use the delimiter syntax (name<<EOF ... EOF) when writing to GITHUB_OUTPUT. A bare echo of a multiline value truncates or corrupts the output. Expected output: multiline values arrive intact in the consuming step.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_Yyhu1kOo73cTuubJ7NiIgw
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.