Skip to content

ci: add reusable Claude PR review with per-repo .claude-review.md guidance#23

Open
leongdl wants to merge 1 commit into
OpenJobDescription:mainlinefrom
leongdl:openjd-root
Open

ci: add reusable Claude PR review with per-repo .claude-review.md guidance#23
leongdl wants to merge 1 commit into
OpenJobDescription:mainlinefrom
leongdl:openjd-root

Conversation

@leongdl

@leongdl leongdl commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Ports the two-stage Claude PR-review integration from aws-deadline/.github so OpenJobDescription repos can opt in, and adds a new mechanism for repo-specific review guidance.

Ported (three files)

  • reusable_claude_pr_review_collect.yml (Stage 1): a no-op that member repos call on pull_request. Its only purpose is to complete, firing the workflow_run event. Fork PRs never see secrets and nothing it produces is trusted.
  • reusable_claude_pr_review.yml (Stage 2): runs from the base repo's default branch with its secrets. Resolves the PR from the trusted workflow_run payload (never Stage 1 output), checks out the PR head read-only, mints a short-lived Bedrock bearer token via OIDC and drops IAM credentials before the agent step, and posts inline review comments with hidden fingerprint markers so re-reviews of later revisions don't duplicate earlier findings.
  • claude-review-requirements.txt: version-pinned aws-bedrock-token-generator, watched by a new pip ecosystem entry in dependabot.yml.

New: per-repo review guidance via .claude-review.md

A repo can commit a .claude-review.md at its root to tell the reviewer what to focus on — e.g. openjd-specifications can describe how to review RFCs and specification-wording changes, while a code repo can call out its invariants.

Security-relevant design decision: the file is read from the PR's base commit, never the PR head. The guidance feeds the reviewer's prompt, so it must be maintainer-controlled — a fork adding or editing .claude-review.md in its own PR must not be able to prompt-inject the review of that PR. Edits to the file take effect only after they land on the base branch. The content is capped at 16 KiB, and the prompt frames it as advisory review focus that cannot override the posting mechanics, duplicate-suppression protocol, or the treatment of PR contents as untrusted data.

Testing

  • YAML syntax validated for both workflows and dependabot.yml.
  • zizmor --config zizmor.yml --min-severity high .github/ (matching this repo's Security Scan gate): no findings.

Not included / follow-ups

  • Member-repo caller stubs (each repo opts in with a small caller workflow, as in aws-deadline).
  • The bedrock_role_arn secret and OIDC role need to be configured for this org before any repo enables it.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…dance

Port the two-stage Claude PR-review integration from aws-deadline/.github:

- reusable_claude_pr_review_collect.yml (Stage 1): a no-op that runs on
  pull_request and exists only to fire the workflow_run event, so fork
  PRs never see secrets.
- reusable_claude_pr_review.yml (Stage 2): resolves the PR from the
  trusted workflow_run payload, checks out the head read-only, mints a
  short-lived Bedrock bearer token via OIDC (dropping IAM creds before
  the agent runs), and posts inline review comments with fingerprint
  markers for cross-revision duplicate suppression.
- claude-review-requirements.txt: version-pinned token generator,
  watched by a new pip ecosystem entry in dependabot.yml.

New in this port: repos can commit a .claude-review.md at their root to
tailor what the reviewer focuses on -- e.g. openjd-specifications can
describe how to review RFC and specification-wording changes. The file
is read from the BASE commit only, never the PR head, so a fork cannot
prompt-inject the review of its own PR; it is capped at 16 KiB and is
advisory guidance that cannot override the prompt's posting mechanics
or security rules.

Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
mwiebe pushed a commit to OpenJobDescription/openjd-specifications that referenced this pull request Jul 17, 2026
Opt in to the two-stage Claude PR-review integration hosted in
OpenJobDescription/.github (see OpenJobDescription/.github#23):

- claude_pr_review_collect.yml (Stage 1): pull_request-triggered no-op
  whose completion fires the workflow_run event. Fork PRs see no
  secrets and nothing this stage produces is trusted.
- claude_pr_review.yml (Stage 2): workflow_run-triggered caller that
  forwards the trusted head repo/SHA and the Bedrock OIDC role secret
  to the reusable review workflow.

Add .claude-review.md, the repo-specific guidance the reviewer reads
from the base branch. It directs reviews of rfcs/ changes to follow the
methodology in skills/openjd-rfc-review/SKILL.md: alignment with the
four design tenets (portable, expressive, human readable/writable,
tooling parseable), RFC template completeness, and compatibility with
the 2023-09 Template Schemas specification. The skill file remains the
source of truth; the guidance inlines the methodology because the
reviewer must not read review instructions from the PR head, which is
fork-controlled.

Signed-off-by: David Leong <116610336+leongdl@users.noreply.github.com>
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.

3 participants