2

My Repo has Branches Apple, Banana & master.

I want to run the action when I push from Branch Apple to Branch Banana, but NOT when Pull Requests are merged into Branch B.

Current Draft of the action starts as;

on:
  push:
    branches:
      - Banana

But, if I merge a PR from a fork into branch Banana, the action will still trigger - How can I stop this?

I've seen the Workflow Syntax about using an IF statement (HERE), but that has no option for "from branch Apple"

Jayden
  • 129
  • 4
  • What about `if: github.ref == 'refs/heads/main'`? – dan1st Jan 14 '21 at 06:24
  • @dan1st that would make the workflow only work if pushed to `main`. I already have it to only work when Apple is pushed to Banana, but PRs to Banana will also trigger the action – Jayden Jan 14 '21 at 09:17
  • You may be able to use the [`GITHUB_EVENT_NAME` or `GITHUB_BASE_REF` environment variables](https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables) to check for pull reqests. – dan1st Jan 14 '21 at 10:31

0 Answers0