From the course: Learning GitHub Actions

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Add dependencies between actions

Add dependencies between actions - GitHub Tutorial

From the course: Learning GitHub Actions

Start my 1-month free trial

Add dependencies between actions

- [Instructor] If we consider our example workflow like a flow chart, we have two jobs that are run in parallel when the workflow is triggered by an event, like a push to the repository. But let's say, for example, that the first job produces some output that the second job needs as input. If they're running in parallel, the second job might fail without that input. So you might be wondering how do we get the first job to run before the second job? We can create that kind of dependency by adding the needs attribute to the second job. When we add the needs attribute to a job, we include the job ID of one or more jobs that must complete successfully before the job will run. Back in our workflow, if we add the needs attribute to job two and follow it by the identifier for job one, job two becomes dependent on job one. We can change our flow chart representation to show this dependency. Now, job one must complete…

Contents