A maintainer is authoring a composite action and wants action.yml to declare an output called report-url whose value comes from a step that has the id generate. The step writes the value to the file referenced by the GITHUB_OUTPUT environment variable. How should the action's metadata reference that step output so consumers can read it?
outputs:
report-url:
description: "Link to the generated report"
value: <expression>- Avalue: ${{ jobs.generate.outputs.report-url }}, because the output is produced inside a job step and the jobs context exposes each step result for the metadata to forward to consumers.
- Bvalue: ${{ env.report-url }}, because the step exported the value to the environment file, so reading it back through the env context lets the action surface the output to its consumers.
- Cvalue: ${{ needs.generate.outputs.report-url }}, because the needs context carries forward outputs from the named unit so the action metadata can publish report-url to callers.
- Dvalue: ${{ steps.generate.outputs.report-url }}, because a composite action output maps to a step output through the steps context using the step id and the output name written to GITHUB_OUTPUT. Correct
Why A is wrong: Tempting because jobs do expose outputs at workflow level, but inside an action the jobs context is not available, so referencing step values through jobs returns nothing.
Why B is wrong: Tempting since GITHUB_OUTPUT looks like an environment file, but it feeds the steps context not env, and env would only work had the step written to GITHUB_ENV instead.
Why C is wrong: Tempting because needs surfaces outputs across dependent jobs, but it applies to job dependencies in a workflow, not to steps within a single composite action, so it resolves to nothing here.
Why D is correct: Composite action outputs bind to a step output via the steps context, so steps.generate.outputs.report-url correctly references the value the generate step wrote to GITHUB_OUTPUT.