GH-200 · Question #62
Which syntax correctly accesses a job output (output1) of an upstream job (job1) from a dependent job within a workflow?
The correct answer is A. ${{needs.job1.outputs.output1}}. To access the outputs in the dependent job, use the needs.<job_id>.outputs.<output_name> syntax. For example, the following job accesses the output1 and output2 outputs defined in job1: # Assume job1 is defined as above runs-on: ubuntu-latest OUTPUT1…
Question
Which syntax correctly accesses a job output (output1) of an upstream job (job1) from a dependent job within a workflow?
Options
- A${{needs.job1.outputs.output1}}
- B${{needs.job1.output1}}
- C${{depends.job1.output1}}
- D${{job1.outputs.output1}}
How the community answered
(23 responses)- A91% (21)
- B4% (1)
- C4% (1)
Explanation
To access the outputs in the dependent job, use the needs.<job_id>.outputs.<output_name> syntax. For example, the following job accesses the output1 and output2 outputs defined in job1: # Assume job1 is defined as above runs-on: ubuntu-latest OUTPUT1: ${{needs.job1.outputs.output1}} OUTPUT2: ${{needs.job1.outputs.output2}} run: echo "$OUTPUT1 $OUTPUT2" https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/pass-job-
Topics
Community Discussion
No community discussion yet for this question.