jobs.<job_id>.needs

1 minute read

Enter a string or array of strings in jobs.<job_id>.needs to specify that a specific job or jobs must complete successfully before this job runs. By definition, a job that fails or is skipped is not a successful job completion, and all jobs that need it to complete are skipped, unless explicitly continued by use of a conditional expression.

In the following example:

  • my-job-2 runs only if my-job-1 completes successfully.

  • my-job-3 runs only if my-job-1 and my-job-2 complete successfully.

jobs: my-job-1: ... my-job-2: needs: my-job-1 ... my-job-3: needs: [my-job-1, my-job-2] ...