Travis CI branch build run on PR from fork

I think I found a strange issue with Travis while working on a GitHub organization I have write access to:
Under some tricky circumstances, Travis may try to pull a non-existing branch.
How to reproduce:
0. Setup: A repo with Travis set up (language: minimal is enough for the Travis configuration), in those howto, I’ll use an organization repo and will refer it as the org repo.

  1. Fork the org repo
  2. Create a branch and a commit, set the upstream to a new branch on the org repo and push it.
  3. Delete the remote branch you just created on the org repo.
  4. Change the upstream of your local branch to your fork, but still use the same branch name (i.e. if remote branch name was foo on the org repo, keep using foo in your fork.
  5. Push it, and create a PR
  6. Check the PR on GitHub, you should have two builds instead of just one: One for the branch, another for the PR.
  7. If you check the branch one, you’ll see that Travis tried to clone the branch you deleted on the org repo.

Examples here:

1 Like
Imprint