From the course: Learning GitHub Actions
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Add conditions to a workflow - GitHub Tutorial
From the course: Learning GitHub Actions
Add conditions to a workflow
- [Instructor] When we use the push and pull request events to trigger our workflow, we can limit activity to specific branches. To set this up, we need to change our YAML formatting a bit. Instead of using a value for the on key, as we see here, the event needs to be in its own YAML block. Basically, we move the event down to the next line and follow it with a colon to indicate a new block with its own mapping. Now we can add the branches conditional, where we can list the branches we want the workflow to focus on. For example, if we want pushes to our repo to only work on the branches named develop and master, we would add a dash and then list those branch names. If we want pull requests to only work on our master branch, we would add a list entreat with master under the pull request attribute. Now, these examples would be for workflows that only have one trigger, a push or a pull request. What if we have a workflow that's…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Create a workflow3m 11s
-
(Locked)
Add jobs and steps to a workflow2m 36s
-
(Locked)
Add actions to a workflow4m 27s
-
(Locked)
Run a workflow2m 31s
-
(Locked)
Add dependencies between actions1m 50s
-
(Locked)
Add conditions to a workflow2m 40s
-
(Locked)
Workflow and action limitations1m 27s
-
(Locked)
Challenge: Develop a complex workflow1m 2s
-
(Locked)
Solution: Develop a complex workflow6m 18s
-
(Locked)
-
-
-
-