Don't run action on both branch and pull request

I’ve got a continuous integration workflow which is quite heavy, with multiplatform testing.
I want it to run:

  • On pushes, on any branch
  • On pull requests coming from other repositories

I currently enabled push and pull_request, but in case of pull requests from branches coming from the same repository, I get the build doubled. Since I already got a branch protection rule preventing merges of unsynced PRs, there is never the case in which I can have different results between the branch and pull request build.

How can I disable it in such case?

1 Like

I suppose you could also restrict push to the default branch (main/master). pull_request will take care of pushes to other branches (type synchronize).