Jobs 'lint' and 'test' both list 'needs: [build]'. Job 'deploy' must run only after both 'lint' and 'test' succeed. Which 'needs' declaration is correct on 'deploy'?
Select an answer to reveal the explanation.
Short Explanation and Infographic
List the immediate upstream jobs you depend on. Deploy waits on lint and test; those already wait on build, so the graph is diamond-shaped without re-listing build.
Full explanation below image
Full Explanation
GitHub Actions builds a DAG from each job's 'needs:' array. If lint and test already depend on build, deploy only needs to list lint and test. That creates a diamond: build fans out to lint/test, then both join into deploy. Listing only build would start deploy as soon as build finishes, ignoring lint/test. Listing build plus lint/test is redundant and can confuse readers; the transitive wait already exists. 'needs: lint && test' is invalid YAML for this key. Always declare the direct predecessors you care about for ordering and for accessing their outputs via the needs context.