Trigger new build when a Pull Request is opened
under review
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
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?
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.
J
James Ovens
This is a workaround, however there is a way using the new pipelines API in CircleCI to trigger a build when you open a PR.Currently when we close a PR in our workflow we listen for a github event for PR closures that then posts that to a lambda webhook which then calls the CircleCI API in order to trigger a workflow to destroy an ephemeral environment we build per PR.So this is possible, which means I'm sure you can do the exact same thing when opening a PR by using a github event that calls a lambda that calls CircleCI's pipelines API to trigger a workflow to run on the branch you have just opened the PR on.Obviously ideally this sort of basic thing should be configurable from CircleCI, however using the new API, a github event and a lambda this is possible for anyone who just needs to get this working in the meantime.
A
Ayoze
We have been waiting so much time for this... Now that github actions supports on_pullrequest we are looking to migrate to actions
Load More
→