Trigger PR build on base branch push

github-integration
github

#1

John pushes to master , Travis builds master , status of master is green.
Jane branches off master , creates branch feature , changes some files and pushes. Travis builds the PR, and shows feature and master merge will be green.
John pushes to master , breaks the build/creates test conflict that will fail a feature merge. But…
Jane looks at her PR build. Which… is still green. So she merges and suddenly, master fails.

How can I make it so that every push to master will trigger the build for every PR?


#2

Set the “Require branches to be up to date before merging” check at Github in Branch Protection settings. Then with any further pushes to master, Jane will be forced to merge master into the feature branch before it could be merged which will trigger another build in the PR.


#3

Thanks for this workaround, but this approach would require explicit merges for even the most trivial of commits to the base branch. Given that the Travis PR build is designed to simulate such a merge, it would make sense for Travis PR build to re-run on every base branch commit as well as every PR branch commit as the simulated merge will change in both scenarios.


#4

Travis cannot do anything with the source, Github is in control of it. Github is also the one who creates “preview” merge commits that Travis uses in PR checks.

You can use a Github bot to automate the task. E.g. https://github.com/travis-ci/travis-ci/issues/1620#issuecomment-406123643 suggests https://github.com/tibdex/autorebase that “auto-rebases” branches, and I also found https://github.com/bobvanderlinden/probot-auto-merge that can “auto update” them (dunno what specifically each means).