How do you pass a value from one job to a dependent job in GitHub Actions?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Jobs run on separate runners, so workflow-level env vars don't persist. Job outputs are the clean, built-in way to pass data between jobs.
Full explanation below image
Full Explanation
Each job runs on a fresh runner, so environment variables set in one job are not available in another. The correct pattern is: (1) in a step, write to $GITHUB_OUTPUT using 'echo name=value >> $GITHUB_OUTPUT'; (2) define the job-level 'outputs:' block mapping names to '${{ steps.step_id.outputs.name }}'; (3) in the downstream job, access via '${{ needs.upstream_job.outputs.name }}'. Workflow-level env: blocks can define static values but cannot receive dynamic values from job steps. Artifacts work for files but not lightweight string values.