Skip to content

Instantly share code, notes, and snippets.

@rpivo
Created March 13, 2021 14:08
Show Gist options
  • Save rpivo/77f6cd430c97df70e7ae0bf58d6181e2 to your computer and use it in GitHub Desktop.
Save rpivo/77f6cd430c97df70e7ae0bf58d6181e2 to your computer and use it in GitHub Desktop.
Getting a GitHub Action to Only Trigger on a Specific Branch

Getting a GitHub Action to Only Trigger on a Specific Branch

The example below runs on push and delete actions on only the main branch for the repo.

name: Example
on:
  push:
    branches:
      - main
  delete:
    branches:
      - main
jobs:
  example_job:
    runs-on: ubuntu-18.04
    steps:
    ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment