Avoid PR head checkout and add prompt profiles#73
Merged
Conversation
kans
approved these changes
May 13, 2026
ggreer
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The PR review workflow runs under
pull_request_targetso it can comment on PRs. Checking out PR head code before the secret-backed review step lets untrusted PR content influence the review environment.This intentionally keeps
pull_request_target. The workflow needs base-repo privileges to use the org review secret and post PR comments/reviews. The safety boundary is thatpull_request_targetmust run only trusted workflow/base-repo code, while PR head code is treated as review data.This PR removes that trust-boundary issue while keeping the review behavior developers rely on: incremental reviews, deduplication of prior findings, inline comments, and review verdicts. It also brings this workflow to parity with the ductone review flow.
What this changes
Security boundary:
This replaces the inline review steps with a composite review action that fetches trusted PR context through the GitHub API. The workflow checks out only the PR base commit with persisted credentials disabled, then the action computes review mode from bot-authored state and GitHub compare data.
After this change, the secret-backed job no longer checks out or executes PR head files. PR contents enter the job as GitHub API responses for the reviewer to inspect, not as code on disk that can affect the runner environment.
The action now scopes review state and concurrency by
github.workflow_ref, ignores human-authored review-state markers, updates only summary comments owned by the same workflow ref, falls back to full review on unsafe compare states, rechecks the PR head before posting, and uploads review context artifacts for debugging.Prompt/profile changes:
The connector-specific prompt remains the default, which preserves required-workflow/ruleset behavior for connector repos. Repos that need the previous broad security/correctness prompt can opt into
generalwithPR_REVIEW_PROMPT=generalor by passingreview_prompt: generalwhen calling the reusable workflow.The connector prompt keeps the existing connector review criteria while using the same trusted state and incremental-review plumbing as the general prompt. The general prompt is structured for SDK and shared-library repos where the change may affect connector-facing contracts without being a connector implementation.
Validation
git diff --checkidentical