Pull Requests and Multiple Default Branches


#1

Hi all, this may have been asked before, but figured I’d see if there have been any updates recently.

A big part of my CI process is leveraging GitHub pull requests. I do not need to run a build on every commit, but I need to run a build on each pull request. Upon merging the pull request, I do need to run another build. I know this is currently possible with the ‘Pull Request Only’ setting and merging to GitHub’s default branch, but is there any way I can have this functionality with multiple default branches? Every time I want to merge to my production branch, I’ll have to change the default branch, not ideal. Example below…

PR submitted -> run build -> Merge to branch ‘frontend-staging’ run build on merge -> 'frontend-staging PR submitted (with merge to master) -> Merge branch to master, run build on merge again.

Hope this makes sense! Let me know if you have any thoughts…


#2

I’ve not looked into this in detail, but you could run a build on a schedule, and then do your internal logic (should a real build be run) inside. If a real build should not be run, exit early and return a success condition.

This has the disadvantage that you will have many successful builds that were not actually builds, but it’d get you up and running.


#3

Wow, they don’t make it easy do they!? I’ll play around with this method, thanks!


#4

They aren’t trying to inconvenience you deliberately :smiley_cat:

If you lurk hereabouts, and on the Ideas board, you’ll see there is a lot of stuff competing for CircleCI product manager attention.

The other thing you could think about is using the HTTP API externally to make trigger decisions. I believe you can kick off a build using this. You’d need another server for this, but a cheapie would be fine.


#5

Ok cool, will check it out!


#6

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.