fix(ci): check out the PR head SHA so the version check works for fork PRs - #9647
fix(ci): check out the PR head SHA so the version check works for fork PRs#9647tushardev-365 wants to merge 1 commit into
Conversation
check-version.yml checks out ref: github.head_ref, which is the bare branch name. That only resolves when the branch lives in this repository, so every pull request from a fork fails before the version comparison runs: ##[error]A branch or tag with the name 'fix/webhook-url-validation-error-message' could not be found github.event.pull_request.head.sha resolves for forks too, because GitHub makes the PR head commit fetchable from the base repository, and it pins the exact commit the PR proposes rather than whatever the branch has moved to. Deliberately staying on pull_request rather than pull_request_target: the job executes node against the PR's package.json, so it should keep the read-only token that comes with pull_request.
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe version-check workflow now checks out the pull request’s head commit SHA instead of the branch name. ChangesVersion check workflow
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to This localized CI change updates the checkout reference so version checks can run for fork pull requests; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
check-version.ymlchecks outref: ${{ github.head_ref }}, which is the bare branch name. That only resolves when the branch lives in this repository, so the version check fails for every pull request coming from a fork, before the comparison even runs. From run 30335374576 (PR #9485, head repookxint/plane):The same failure shows up in run 26230557089 (
fix/pages-nav-guest-access). Same-repo PRs are unaffected, which is why the check mostly looks healthy: the other recent failures of this workflow are the intended version-equality gate doing its job.The fix is to check out
${{ github.event.pull_request.head.sha }}instead. GitHub makes the PR head commit fetchable from the base repository even for forks, and it pins the exact commit the PR proposes rather than whatever the branch has moved to since.One thing I deliberately did not do: switch the trigger to
pull_request_target. The job runsnode -pagainst the PR'spackage.json, so it should keep the read-only token thatpull_requestprovides.Type of Change
Screenshots and Media (if applicable)
Not applicable, CI-only change. The error line above is from the linked run logs.
Test Scenarios
I cannot trigger this workflow from a fork PR against
previewsince it only runs on PRs targetingmaster, so verification was against the run history: fork-PR runs fail on the checkout step with the error above, same-repo runs proceed to the version comparison. After this change the checkout resolves for both cases; the rest of the job (git fetch origin master:master, checkout ofmaster, version comparison) is unaffected because it operates on the base repository's refs.References
Failing runs 30335374576 and 26230557089 on this workflow.
Summary by CodeRabbit