Commit 9aa02ee
Fix git checkout error by using commit hash instead of ref
The workflow was failing with "pathspec 'refs/pull/170/merge' did not match any file(s)" because:
- GitHub Actions passes ${{ github.ref }} which is 'refs/pull/170/merge' for PRs
- This is a GitHub-specific reference that exists remotely but can't be checked out as a local branch
- After pushing to pr-screenshot branch, script tried to checkout this ref and failed
Fixed by:
- Saving the current commit hash (git rev-parse HEAD) before switching branches
- Using that commit hash to return to the original state (works in detached HEAD mode)
- This approach works regardless of whether we're on a branch, tag, or PR merge ref
The workflow will now:
1. Save current commit hash
2. Switch to pr-screenshot branch and push screenshots
3. Return to the saved commit hash (detached HEAD is fine in CI)
4. Continue with subsequent workflow steps that check for changes and comment on PR
Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>1 parent fb369b0 commit 9aa02ee
1 file changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
112 | | - | |
113 | | - | |
114 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
0 commit comments