Only Run Github Actions on Specific Branches

Keith Weaver
4 min readOct 3, 2019

The original can be found here on my personal website.

In this tutorial, we focus on running Github Actions on the push event for specific branches. This may be useful if you only want to test on feature branches and do a deployment if master. This was the use case for me. After the tests have passed, the the code review has been approved. It’s time to deploy to production. This is merging to master and running a series of steps. Github Actions makes it very simple to run specific actions/workflows on specific branches.

As I write this tutorial Github Actions is in beta. You should check to see if you have access first. There would be a tab called Actions if you do have access.

Project Setup on Local

Start by creating a project or you can add to your existing one.

Clone your Git project to your local.

git clone your_git_project>
cd your_git_project_folder_name>

--

--

Responses (1)