Skip to content

fix(ci): check out the PR head SHA so the version check works for fork PRs - #9647

Open
tushardev-365 wants to merge 1 commit into
makeplane:previewfrom
tushardev-365:fix/check-version-fork-prs
Open

fix(ci): check out the PR head SHA so the version check works for fork PRs#9647
tushardev-365 wants to merge 1 commit into
makeplane:previewfrom
tushardev-365:fix/check-version-fork-prs

Conversation

@tushardev-365

@tushardev-365 tushardev-365 commented Aug 20, 2026

Copy link
Copy Markdown

Description

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 the version check fails for every pull request coming from a fork, before the comparison even runs. From run 30335374576 (PR #9485, head repo okxint/plane):

##[error]A branch or tag with the name 'fix/webhook-url-validation-error-message' could not be found

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 runs node -p against the PR's package.json, so it should keep the read-only token that pull_request provides.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

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 preview since it only runs on PRs targeting master, 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 of master, 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

  • Chores
    • Improved pull request validation reliability by ensuring checks run against the exact submitted commit.

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.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d3c3fc8-8f2a-4ead-934f-896b6573b805

📥 Commits

Reviewing files that changed from the base of the PR and between e056bbf and 2fca9f9.

📒 Files selected for processing (1)
  • .github/workflows/check-version.yml

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The version-check workflow now checks out the pull request’s head commit SHA instead of the branch name.

Changes

Version check workflow

Layer / File(s) Summary
Pin checkout to pull request commit
.github/workflows/check-version.yml
The checkout step uses github.event.pull_request.head.sha instead of github.head_ref.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 2fca9

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)
Check name Status Explanation
Description check ✅ Passed The description follows the template, explains the fork PR failure, identifies the fix, records test scenarios, and provides references.
Title check ✅ Passed The title clearly and concisely describes the CI fix for checking out the PR head SHA, including the fork PR context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants