Trigger new build when a Pull Request is opened
complete
M
Madison Bahmer
Circle CI should generate a new build when a pull request is opened on github. The current implementation uses the branch's most recent commit result, instead of generating a brand new build.
Consider the following situation.
1) An engineer creates a branch within github, and pushes code up at their leisure. Circle CI builds the project on each commit.
2) When it comes time to make a pull request, the engineer opens up a PR on github, without creating a new git commit.
This workflow does not seem to trigger a new build of the branch on Circle CI, and instead Circle CI uses the build result of the most recent commit as the build status of the Pull Request. This seems to be an obvious workflow flaw given that I may have additional logic to build a PR artifact for testing purposes, vs the normal branch commit process. This has been discussed both here and here on your forums as well.
I have found 2 additional configurations under "advanced settings" that compliment this idea, but do not do what I intend.• Build forked pull requests• Only build pull requests
As a counterpoint, you can configure both Jenkins and Travis CI to do this, so this seems like a pretty straightforward use case of the platform. Obviously, if you if you push an additional commit to the branch that already has an existing PR, the additional variables or logic within Circle CI will be present.
CCI-I-316
B
Benedetta Dal Canton
complete
This functionality has been shipped
B
Benedetta Dal Canton
Hi, PM at CircleCI here.
I'm happy to announce that we have just
introduced the ability to run pipelines on a broader range of GitHub events
, including pull request events.Pipelines can now be set up with explicit triggers, and configured to run on specific events. Two in particular should be interesting to folks in this thread:
- PR Opened
- PR opened or pushed to, default branch pushes, tag pushes, which is an extension of the previously available option"only build pull request"but will also trigger a pipeline when a PR is opened, not just when it's pushed to.
The full range of options available is:
- All pushes
- Tag pushes
- Pushes to default branch
- PR opened or pushed to, default branch pushes, tag pushes
- PR opened
- PR merged
- PR marked ready for review
- “run-ci” label added to PR
And we are looking to rapidly expand the range of options provided based on your feedback.
You can find more information about to set this up here, and in our Community Forum post.
For any questions, feedback or help setting this up, feel free to respond directly on here or email me directly at benedetta@circleci.com.
cc Sebastian Lerner
B
Benedetta Dal Canton
Hi all, PM at CircleCI here.
We are currently working on a solution (for our Github App integration, specifically) that will allow for much more flexibility in deciding which Github events should trigger which workflows, including supporting this use case.
I'd love some feedback on how we're thinking of approaching this. If you want to make sure your voice is heard, send me an email at benedetta@circleci.com.
J
Jonathan Boudreau
Benedetta Dal Canton We have a multi-branch (think gitflow) monorepo. When someone opens a pull request, we use dynamic config to run jobs only relevant to the changes being made. The problem with push only builds is you have to open the pull request fast enough otherwise you won't have anything to diff against. We're currently using a "default branch" when the dynamic config runs before a pull request is opened, but this often means running the wrong jobs.
M
Mehdi Mosbah
Benedetta Dal Canton Hello could you please let me know if the option to run a pipeline on a pull request has been implemented? If not, do you have any suggestions on how to bypass this limitation?
B
Benedetta Dal Canton
Mehdi Mosbah this feature is not yet available, but is coming soon - at the start the new year.
In the meantime, you can use the CircleCI GitHub Action as a workaround to achieve what you need.
Nathan Fish
under review
ali glance
almost end of 2022. If this still does not exists, I am going to dump circleci today and switch to github actions
Merged in a post:
New Workflow Filter: Branches>Pull_Request
K
Kyle Tryon
Currently a push to a branch may be ran before a pull request is created and a new job will not be triggered when a pull request is opened. This can cause issues for developers who are relying on the
CIRCLE_PULL_REQUEST
env var for certain scripts.Currently the only solution is to enable "Build Pull Requests Only" in the advanced settings for the project as a whole.Proposed solution:workflows:
version: 2
dev_stage_pre-prod:
jobs:
- test_dev:
filters:
branches:
only: dev
pull_request: true
pull_request: true can be used as a boolean to filter non-pull_request jobs.
CCI-I-685
N
Nimrod M
any update?
D
Desmond Ho
even the f__king google cloud build can do thishow come circle ci not having such essential features for 1.5 yrs after reported
M
Mike Dodd
Any update on this?
D
Devops
This is a very basic feature that is mysteriously missing only from CircleCI. We will soon have to migrate to TravisCI because of this. Unfortunate.
Load More
→