nerdexam
Microsoft

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…

Author and Maintain Workflows

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)
  • A
    91% (21)
  • B
    4% (1)
  • C
    4% (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

#GitHub Actions#Workflow Outputs#Job Dependencies#Expression Syntax

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice