checkout: Cannot use parent specifiers in the ref
I’d like to run an action on a pull_request and check out the actual content of the PR, not a merge with master
(because I want it to run even if there is a merge conflict among other reasons). Support for specifying this has been requested on the community forum.
I’ve tried the following:
with:
ref: ${{ github.ref }}^2
Which causes a failure because it tries to do:
git fetch --tags --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/pull/3/merge^2:refs/remotes/pull/3/merge^2
which is an invalid refspec.
Doing this seems to just get completely ignored:
with:
ref: ${{ github.sha }}^2
I haven’t found a way to use $GITHUB_SHA
yet either (it seems to be used literally when in a with
block).
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (12 by maintainers)
Commits related to this issue
- Experimenting see https://github.com/actions/checkout/issues/61#issuecomment-557754095 — committed to fisker/prettier by thorn0 4 years ago
- Setup code style fix action Test commit_message with ref Update code-style.yml Experimenting see https://github.com/actions/checkout/issues/61#issuecomment-557754095 Experimenting 2 Experiment... — committed to prettier/prettier by fisker 4 years ago
- Setup code style fix action Test commit_message with ref Update code-style.yml Experimenting see https://github.com/actions/checkout/issues/61#issuecomment-557754095 Experimenting 2 Experiment... — committed to prettier/prettier by fisker 4 years ago
- fix: checkout of head commit during PR creation * according to https://github.com/actions/checkout/issues/61#issuecomment-561363340 — committed to flameshot-org/flameshot by holazt 4 years ago
- fix: checkout of head commit during PR creation * according to https://github.com/actions/checkout/issues/61#issuecomment-561363340 — committed to flameshot-org/flameshot by holazt 4 years ago
@mrrobot47 thanks. also note, the first option is a race condition because the PR can be updated before the job starts (ref update)
@peter-evans sorry its
refs/remotes/pull/###/head
orpull/###/head
i played around with this locally by fetching everything under pull: