Update all uses of actions/checkout
to use explicit ref
#3322
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
actions/checkout
usesGITHUB_SHA
by default for theref
which it checks out. This sometimes leads to confusing issues, because thepull_request
commit actually operates not on the latest commit of a pull request, but on the latest merge commit of a pull request. This causes a lot of confusion and even actual bugs.In this PR, I'm setting all the
ref
values explicitly to whatever is available:reusable_build_and_publish_web
has arelease-commit
inputgithub.event.pull_request.head.ref
, which points to the HEAD of the PR branch.github.sha
. For example apush
tomain
will still usegithub.sha
, which is fine.There are caveats. With these changes, we no longer test PRs on the merge commit. That means if your PR is out-of-date with the target branch (e.g.
main
), and someone pushes tomain
, you are less likely to find out about any potential incompatibility if it doesn't cause a merge conflict. This means we need to be careful about merging without being up-to-date withmain
. Worst case scenario it will result in more failures onmain
which we'll be notified about on Slack.The main benefit of this is less confusion about which commit we're on when viewing the web demo, which is an essential part of our overall workflow at this point. Once we get over the
source_hash
situation and have the ability to turn on merge queue, we'll once again have much more "main safety".Before:
After:
Checklist