Home > Blockchain >  how to exclude Master branch on a push event
how to exclude Master branch on a push event

Time:06-20

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?

CodePudding user response:

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

  • Related