I’m unable to trigger CircleCI status check for merge requests on my master branch in Github.
Strangely enough, when I initially did a setup on CircleCI with Github, everything was fine, the pipeline was properly getting invoked on every pull request events and showing the status checks, but then I noticed that the pipeline was also running after merging to master branch, which is a waste of compute resources, so then I decided to do something about it.
After changing some settings on the CircleCI UI, I ended up with this issue.
In some of the circleci discussions suggested to enable the Only build pull requests, but for some reason I don’t have it, even though it seems that I’m using the Github OAuth app integration with url https://app.circleci.com/pipelines/circleci/....
pipeline is triggered in push to feature branches, only when it’s used in PR (opened/synchronized/closed)
pipeline is NOT triggered in push to the default branch (the pipeline already ran before at the PR state, hence there is no need to run it on the same code again)
Note that if you’re doing branch and filters on some jobs in the same workflow, you’ll need to make sure to include both branches and tags on all filters in that workflow.
You can use a YAML anchor if you want to repeat the same set of filters on multiple workflows
branch_filter: &branch_filter
filters:
branches:
ignore:
- main
# just an example of another ignore pattern
- /renovate\/.*/
# [...]
workflows:
version: 2
ci_checks:
jobs:
- job1:
<<: *branch_filter
- job2:
<<: *branch_filter
# this one has no filter
- job3
@IliyanKostov9 got it, thanks for clarifying. and thanks @wyardley. Let us know if the answer Will gave isn’t sufficient?
Additionally, this is something that we’re looking at making a bit more intuitive to set up. You can see an example of what that interface might look like here in Benedetta’s comment: Canny
Let me know if you have any feedback on that approach as well.