Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to exclude Master branch on a push event

I have a GitHub Action workflow that I want to run on a push to any of the branches in my repository with an exception of ‘Master. I don’t want the workflow to run on a push to master branch but run on push to other branches in my repository. Please how can I specify that in the workflow?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In your Github Actions workflows file you can specify

name: Deploy staging
on:
  push:
    branches-ignore:
      - master

You can also explicitly include branches you want by doing the following:

name: Deploy staging
on:
  push:
    branches:
      - develop

Changing or adding branches to include the relevant branches that you want. In this manner, workflows will only run to those elected branches.

Here is the relevant section of the Github docs on branches and tags

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading