Conversation
- add a labeled pull_request_target trigger so review runs can be requested from the PR itself - remove the separate issue_comment workflow now that label-based review requests are supported - keep the existing automatic review behavior for non-draft same-repo pull requests
There was a problem hiding this comment.
★★★☆☆
The label-trigger path (pull_request_target + labeled) will check out the wrong code.
.github/workflows/kompass-pr-review.yml:24 — When pull_request_target fires on a labeled event, actions/checkout defaults to checking out the base branch (main), not the PR's code. This is because GITHUB_SHA and GITHUB_REF point to the base ref for pull_request_target events.
The deleted comment workflow handled this correctly by fetching PR details and explicitly checking out the PR head. This workflow needs the same treatment.
Suggested fix for the checkout step:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
token: ${{ steps.token.outputs.token }}Using head.sha instead of head.ref pins the exact commit and avoids race conditions if the branch is pushed to while the workflow is starting. Using head.repo.full_name ensures fork PRs are checked out correctly. fetch-depth: 0 preserves the full git history that the comment workflow had.
This fix is safe for the pull_request path too — explicit ref/repo values override the defaults, and the values are available in both event contexts.
|
The workflow-level checkout is intentionally the trusted base-repo checkout.
If we changed the workflow checkout to So the intended sequence here is:
Because of that, I don't think the suggested workflow-level PR checkout change is correct for this design. |
Ticket
SKIPPED
Description
Move PR review triggering into the main review workflow so maintainers can request reviews with a
reviewlabel while keeping the existing automatic PR review flow.Checklist
Review Triggers
reviewlabel.Workflow Cleanup
Validation
reviewstarts the review workflow.