Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 3

How to restrict an action to a specific branch

Solved! Go to Solution.

I thought this would restrict all  jobs defined in the same yml file to only run when code is pused to the UAT branch:

 

on:
push:
branches:
- UAT

 

However, the job in this same file runs when  code is pushed to any branch, e.g. develop

 

How do I only make the job run when code is pushed to UAT branch?

2 Replies
Highlighted
Ground Controller Lvl 1
Message 2 of 3

Re: How to restrict an action to a specific branch

Or am I just reading the interface wrong...

 

If I make a change on another branch (e.g. develop) and push the change - it doesn't appear to trigger a build. However if I merge that change into UAT and push that up a build starts but on the Actions board it says it was triggered by the develop branch which is confusing me!

 

Screenshot 2020-02-12 at 14.48.01.png

Highlighted
Solution
Ground Controller Lvl 1
Message 3 of 3

Re: How to restrict an action to a specific branch

After a bit of testing I am sure it's just not understanding the Github actions interface. The branch in that listing of triggered actions is the branch the last commit was committed to - but the build isn't triggered until the work is merged into the UAT branch.