Replies: 1 comment
|
Limit # push.yaml
on:
push:
branches:
- develop
- mainKeep PR validation on the PR workflow: # pull_request.yaml
on:
pull_request:
types: [opened, reopened, edited, review_requested, synchronize]
branches:
- developFeature-branch pushes then only run the PR workflow. Direct pushes to Pitfall: |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Let's say that we have the following scenario:
There is a Repository that have the following structure regarding the branches:
Inside this repository are 2 workflows:
push.yamlandpull_request.yamlFirst workflow triggers every time a push occurs since it have this trigger:
on: push:Second workflows triggers every time a Pull Request is opened or changed since it have this trigger:
on: pull_request: types: [opened, reopened, edited, review_requested, synchronize]When I open a Pull Request from a feature branch to develop both workflows triggers. By pushing a commit again triggers both workflows. The thing is that I don't want the
pushworkflow to trigger here. I want it to trigger on every other push except here.Is there any solution in preventing the
push.yamlworkflow to run when a commit is pushed for the Pull Request?The only solution that I could find is this. The problem with this is that it cancels the push workflow and mark it as failure. By doing that I am not able to merge the changes since not all checks are successful.
All reactions