Add PR check run lifecycle - #41
Conversation
There was a problem hiding this comment.
📋 PR Summary:
This PR lets the action own the exact-SHA PR checkout after trigger validation and publish an advisory GitHub Check Run on the PR head, making comment-triggered reviews visibly progress on the PR instead of appearing inert. It adds a new Node script (check-run.js) that creates/completes a Check Run via the GitHub API, reworks the local git setup to avoid re-materializing large repos, and broadens the same-SHA deduplication bypass so explicit comment triggers can be retried. Check Run publishing and the action-owned checkout are opt-in via new inputs and fail gracefully.
7 files reviewed
| File | Changes |
|---|---|
action.yml |
Add checkout-pr/publish-check/check-name inputs, Check Run steps, and mixed-reset git diff prep |
scripts/check-run.js |
New script to create/complete an advisory Check Run via GitHub API |
scripts/check-run.test.js |
node:test unit tests for Check Run payloads and run() flow |
scripts/determine-claudecode-enablement.sh |
Broaden same-SHA dedup bypass to slash_command and mention triggers |
scripts/test-determine-claudecode-enablement.sh |
Add test for same-SHA slash_command review comment bypass |
docs & CI |
Document new inputs/outputs and wire up check-run test job |
Found 1 reliability issue. Consider addressing the suggestions in the comments.
There was a problem hiding this comment.
Pull request overview
This PR adds a Check Run lifecycle for PR-triggered reviews so progress is visible on the PR head SHA, and refines trigger/checkout behavior to avoid cloning the default branch for issue_comment workflows.
Changes:
- Add a Node-based helper (
scripts/check-run.js) plus tests to start/complete an advisory GitHub Check Run against the exact PR head SHA. - Update action inputs/docs to optionally let the action own the exact-SHA checkout (
checkout-pr) and to publish checks (publish-check/check-name). - Extend SHA deduplication to allow explicit comment/mention-triggered retries on the same SHA, and add coverage for that case.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/test-determine-claudecode-enablement.sh | Adds a regression test for same-SHA retries via explicit review comment trigger. |
| scripts/determine-claudecode-enablement.sh | Allows explicit comment/mention triggers to bypass same-SHA deduplication. |
| scripts/check-run.test.js | Introduces Node tests covering Check Run payloads and request wiring. |
| scripts/check-run.js | New script to create/complete GitHub Check Runs via REST API. |
| README.md | Documents new permissions (checks: write) and new inputs/outputs for checkout and Check Runs. |
| action.yml | Adds new inputs/outputs, starts/completes Check Runs, and optionally checks out the exact PR head SHA. |
| .github/workflows/test-claudecode.yml | Runs the new Check Run script tests in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pweiskircher
left a comment
There was a problem hiding this comment.
Addressed the review feedback in the latest commits.
Resolves the action.yml conflict from #41 (check run lifecycle): both branches added a guarded gh CLI install; kept main's variant since it is functionally identical. Verified post-merge that the credential strip in the scan step still runs after all checkout/fetch steps (including the new action-owned checkout), and that the Node 22 bump and jq guard survived the merge. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
What changed
reviewcommands before cloning the repositoryWhy
issue_commentworkflows are attached to the default branch, which made comment-triggered reviews appear inert and caused callers to clone the default branch before resolving the PR. The Check Run makes progress visible on the PR and the action-owned checkout removes that unnecessary clone.Validation
node --test scripts/check-run.test.js./scripts/test-detect-trigger-type.sh./scripts/test-determine-claudecode-enablement.shaction.ymlas YAML