I have a CI action to run tests on my repo for every pull request that is open or every push to a branch. I did it this way so we can have the tests running on a pushed branch even if a PR is not opened yet.
However, if a commit is pushed and a PR created right after, the action is triggered twice which is not very smart. I found this action that cancels previous running workflows in that branch but when both are triggered and one is cancelled I always get a notification email which is annoying…
It has been working well so far but now, the pull_request workflow fails and the push passes. Before I didn’t get both showing in the PR and now it does. Also, if I re-run the PR jobs, they fail again but the push workflow always passes.
Is there a smarter way to have this CI be triggered on PR and/or pushes to branches (with or without a PR open)?
on: pull_request: types: [opened] push: branches: - "*" - "!master" - "!staging"