#47 For GitHub PR builds, should test the "refs/pull/$PR/merge" ref 11 months ago

Ticket created by ~njs on ~sircmpwn/dispatch.sr.ht

For each PR, GitHub provides two different refs that you can check out and test:

refs/pull/$PR/head: this is the actual head commit on the PR branch

refs/pull/$PR/merge: this is the result of merging the PR head commit with the target branch (e.g. master) head commit, i.e., it's what you'd get if you clicked "merge" right now

Generally, the latter is what you want to test in a CI system, and that's what every CI system I'm aware of does (e.g. Travis, Github Actions, etc.)..... except for sr.ht.

As an example of a situation where this caused a problem, we recently had an issue where a bug in our sr.ht build .yml was causing all PRs to fail. We merged a PR to fix it: https://github.com/python-trio/trio/pull/1838

...and on other CI systems, we could then go around to all the failed PRs and rerun them and it would pick up the fix and be good to go. But on sr.ht it seems like we need to manually merge or rebase each PR before sr.ht will notice the fix on master: https://github.com/python-trio/trio/pull/1832#issuecomment-751837992

(As an annoying implementation note: IIUC GH sometimes takes a bit to generate the /merge ref, so you might need some logic to wait for GH's state to settle before pulling it.)