-
Notifications
You must be signed in to change notification settings - Fork 0
[sync] Create .github/workflows/dispatch-review.yaml #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,76 @@ | ||||||||||||||||||||||||
| # Runs the dispatch GATE for AI code reviews on this repo's PRs. | ||||||||||||||||||||||||
| # Forwards to the shared decider workflow in nsheaps/agents, which evaluates | ||||||||||||||||||||||||
| # whether to dispatch a review and (if yes) fires a repository_dispatch to the | ||||||||||||||||||||||||
| # target agent repo's dispatch-receiver-review.yaml. | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # This file is a template — copy into your repo at | ||||||||||||||||||||||||
| # `.github/workflows/dispatch-review.yaml`. Synced via `nsheaps/.github` CI | ||||||||||||||||||||||||
| # automation when configured; until then, copy-paste. | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Spec: https://github.com/nsheaps/agents/blob/main/plugins/claude-code/review-utils/specs/review-dispatch.md | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Requirements (provisioned via nsheaps/.github/secret-sync.yaml): | ||||||||||||||||||||||||
| # - AUTOMATION_GITHUB_APP_ID | ||||||||||||||||||||||||
| # - AUTOMATION_GITHUB_APP_PRIVATE_KEY (automation-nsheaps[bot]; installed on | ||||||||||||||||||||||||
| # THIS repo for label edit + check_run | ||||||||||||||||||||||||
| # posting, AND on the target agent repo | ||||||||||||||||||||||||
| # so it can fire repository_dispatch) | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # Why automation creds (not REVIEW_GITHUB_APP_*)? The gate is routing only — | ||||||||||||||||||||||||
| # it never speaks AS the reviewer. It edits a label, posts a queued check, and | ||||||||||||||||||||||||
| # fires a repository_dispatch. The reviewer-identity (REVIEW_GITHUB_APP_*) is | ||||||||||||||||||||||||
| # owned by the target agent's `dispatch-receiver-review.yaml`, where the review | ||||||||||||||||||||||||
| # actually executes. See plugins/claude-code/review-utils/specs/review-dispatch.md | ||||||||||||||||||||||||
| # §Secrets for the gate-vs-receiver creds rationale. | ||||||||||||||||||||||||
| # | ||||||||||||||||||||||||
| # LLM-auth secrets (REVIEW_ANTHROPIC_API_KEY / CLAUDE_CODE_OAUTH_TOKEN) are | ||||||||||||||||||||||||
| # NOT needed here — owned by the target agent's receiver for the same reason. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| name: Dispatch PR Review | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||
| types: [opened, reopened, synchronize, ready_for_review, labeled] | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Explicit top-level permissions (mirrors the job-level grant below) so | ||||||||||||||||||||||||
| # checkov's CKV2_GHA_1 ("top-level permissions not write-all") is satisfied. | ||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||
| checks: write | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||
| review: | ||||||||||||||||||||||||
| # Gate: review fires automatically on any OPEN, non-draft PR event | ||||||||||||||||||||||||
| # (opened, reopened, synchronize, ready_for_review) -- no label needed. | ||||||||||||||||||||||||
| # The `request-review` label only matters to FORCE a review on a DRAFT | ||||||||||||||||||||||||
| # PR (apply the label while it's still a draft). `converted_to_draft` | ||||||||||||||||||||||||
| # does NOT fire a review by itself -- a PR converted to draft is simply | ||||||||||||||||||||||||
| # not reviewed until it's marked ready again or explicitly labeled. If | ||||||||||||||||||||||||
| # you change the request label name, update the literal in the `==` | ||||||||||||||||||||||||
| # comparison below. | ||||||||||||||||||||||||
| if: | | ||||||||||||||||||||||||
| github.event.pull_request.state == 'open' && | ||||||||||||||||||||||||
| ( | ||||||||||||||||||||||||
| github.event.pull_request.draft != true || | ||||||||||||||||||||||||
| (github.event.action == 'labeled' && github.event.label.name == 'request-review') | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| # Explicit permissions: default_workflow_permissions is "read" in many | ||||||||||||||||||||||||
| # repos but the called workflow needs pull-requests + checks write. | ||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||
| checks: write | ||||||||||||||||||||||||
| # @main = rolling updates: any change merged to nsheaps/agents takes effect | ||||||||||||||||||||||||
| # on the next PR event in repos using this template. This is intentional — | ||||||||||||||||||||||||
| # operators who need pinned stability should replace @main with a commit SHA | ||||||||||||||||||||||||
| # and update it in lock-step with plugin version bumps. | ||||||||||||||||||||||||
| uses: nsheaps/agents/.github/workflows/review-dispatch.yaml@57debfca1958b3632acd8b9a29bff99573b99993 # main | ||||||||||||||||||||||||
|
Comment on lines
+64
to
+68
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🐛 P1 — Comment contradicts the actual The block comment says So a reader is told "this file uses
Either the sync process rewrote
Suggested change
If this file is supposed to use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 P2 — Trailing The Convention in the actions ecosystem (and what Dependabot / Renovate emit) is a stable identifier — a tag, or at minimum a date: If |
||||||||||||||||||||||||
| # secrets: inherit doesn't pass cross-repo (GitHub limitation). | ||||||||||||||||||||||||
| secrets: | ||||||||||||||||||||||||
| AUTOMATION_GITHUB_APP_ID: ${{ secrets.AUTOMATION_GITHUB_APP_ID }} | ||||||||||||||||||||||||
| AUTOMATION_GITHUB_APP_PRIVATE_KEY: ${{ secrets.AUTOMATION_GITHUB_APP_PRIVATE_KEY }} | ||||||||||||||||||||||||
| # Optional overrides (uncomment to use): | ||||||||||||||||||||||||
| # with: | ||||||||||||||||||||||||
| # target-repo: nsheaps/.ai-agent-henry # default | ||||||||||||||||||||||||
| # event-type: pr-review # default repository_dispatch event_type | ||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 P2 —
converted_to_draftclarification is confusing because that event isn't in the trigger listThe comment tells the reader
converted_to_draft"does NOT fire a review by itself" — but that event isn't inon.pull_request.typesabove (line 33) at all, so of course it doesn't fire anything. Leading with an event that literally cannot fire this workflow makes the reader hunt for context.The useful content is: "if a PR is currently a draft, the
if:skips it unlessrequest-reviewis applied." Suggest tightening to that:(This also implicitly clarifies what happens post-
converted_to_draft— subsequentsynchronizeevents are gated out — without naming a non-triggering event.)