Skip to content

ci: review every pull request with Claude - #79

Merged
furedea merged 7 commits into
mainfrom
ci/review-every-pull-request-with-claude
Nov 6, 2026
Merged

furedea merged 7 commits into
mainfrom
ci/review-every-pull-request-with-claude

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

概要

すべての pull request に Claude のレビューを付けます.レビュー本体は共有リポジトリ furedea/reusable-workflows の claude-review.yml にあり,agent-config は ci.yml の 1 ジョブとして呼びます.

  • ci.yml に claude-review ジョブを追加しました.uses: furedea/reusable-workflows/.github/workflows/claude-review.yml@fc0cba95e88e0cdad9837bf8212d324f3cad50a5 # main(full SHA 固定)で,contents: read と pull-requests: write だけを付与し,シークレット claude_code_oauth_token に CLAUDE_CODE_OAUTH_TOKEN を渡します.if は付けていません(実行するかどうかは再利用側が決め,その判定ジョブは常に成功します).
  • all-green の needs に claude-review を加えました.P0/P1 が残っている PR は all-green が赤になります.
  • この PR の前の版で作った claude_review.yml と claude_review_reusable.yml は削除しました(本体は reusable-workflows に移っています).

Closes #78

経緯と検証

この PR は最初,agent-config 内にレビューのワークフローを置く設計でした.その版で,PR を開いたときの実行,push での再実行,P0/P1 でのチェック失敗を確認し,所要時間は約 28〜44 秒でした.その後,本体を reusable-workflows に移す設計に変わったため,この PR を作り直しました.

別リポジトリからの呼び出しは,この PR(3b8fff6)で確認しました(run 42205020745).

  • claude-review / Decide whether to review(4 秒)と claude-review / Claude review(44 秒)が成功した.
  • all-green が緑になり,チェックは全 20 件が成功した.
  • レビューが実行され,要約コメントが付いた(ブロッキングなし).

Claude review の指摘は 1 点で,push や fork での挙動が未確認という注意でした.再利用側(fc0cba9)を読んで確認したところ,不具合ではありません.

  • Decide ジョブは pull_request 以外(push),fork の PR,furedea-agent 以外の bot の PR で false を出し,Claude review ジョブだけがスキップされます.
  • Decide ジョブは常に成功するので,呼び出し側のジョブが skipped になって all-green を落とすことはありません.
  • 再利用側のレビューは --model claude-opus-5-5,--effort medium で固定されています.

fork の PR と bot の PR で実際に動かした確認は,この PR では行っていません(この PR は同一リポジトリの通常の PR のため).

actionlint,zizmor(新しい箇所の指摘なし.既存の ./.github/actions/... への low の指摘 3 件は元からある),ls-lint はローカルで通っています.

🤖 Generated with Claude Code

Closes #78

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Claude review summary

No P0/P1 findings. Reviewed the two new workflows: the pull_request trigger (not pull_request_target), empty top-level permissions, SHA-pinned actions, the fork guard, the narrow --allowedTools list, and the validation of blocking_findings before the gate step all look sound.

Minor note (not posted inline): the 'Explain review failure' step always lists the token-expiry hint, even when the failure is something else, such as a Dependabot-triggered run that has no access to CLAUDE_CODE_OAUTH_TOKEN.

blocking_findings: 0

🤖 Generated with Claude Code

Comment thread tmp-review-check/p0_probe.js Outdated

// Shell injection: untrusted input is executed as a shell command.
function runUserCommand(userInput) {
return execSync(userInput).toString();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: execSync(userInput) runs arbitrary input as a shell command, which is command injection. Nothing in the repo imports this module today, so it can't be exploited yet. But a scratch "probe" file shouldn't be merged, and anyone who wires it up later inherits the hole. Remove the whole tmp-review-check/ directory from this PR.

Comment thread tmp-review-check/p0_probe.js Outdated

// Hardcoded credential and an always-true fallback bypass the check.
function checkPassword(supplied) {
return supplied === "admin123" || true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: checkPassword always returns true because of || true, and it also hardcodes the credential admin123. Any caller gets an authentication bypass. Like the finding above, remove this file from the PR.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Review summary

  • P1: tmp-review-check/p0_probe.js is a scratch file that contains command injection (execSync(userInput)), a hardcoded credential, and an always-true password check. Nothing imports it, but it should not be merged. Remove the directory.
  • The workflow files (claude_review.yml and claude_review_reusable.yml) look fine. Actions are pinned by SHA, permissions are minimal, fork PRs are skipped, and the blocking-count check validates its input.

Blocking findings: 2 (P1).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Review summary: no P0/P1 findings. The PR adds a Claude review workflow and a reusable workflow. Actions are pinned by SHA, permissions are minimal, fork PRs are skipped, and the fail-on-blocking step validates its output before using it. I didn't find a bug or security problem worth flagging.

Blocking findings: 0

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Review summary: No P0/P1 findings. I read the full diff: the caller workflow, the reusable workflow, the fork guard, SHA-pinned actions, minimal permissions, the tool allowlist, and the structured-output gate. I found nothing that should block the merge.

One optional note (P3): in the "Explain review failure" step, if the review step succeeds but returns malformed structured output, the summary says "Blocking findings (P0/P1): read the inline review comments". That is misleading, because the real cause is invalid output. You could check for this case separately.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Review summary: No P0–P3 findings. I read the gate, failure-explanation and fork-skip logic and found no correctness or security problems. The gate step, the reason=invalid-output path and the Explain review failure branches behave as the PR describes.

Blocking findings (P0/P1): 0

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Claude review summary

I reviewed .github/workflows/claude_review.yml and .github/workflows/claude_review_reusable.yml and found nothing to report at any severity (P0–P3).

What I checked:

  • Permissions: the workflow default is permissions: {}. The job gets only contents: read and pull-requests: write. Checkout uses persist-credentials: false, and actions are pinned to commit SHAs.
  • Fork PRs: the head.repo.full_name == github.repository guard skips them, so the secret and write token never reach untrusted code.
  • Prompt injection: the only values put into the prompt are the repo name and PR number. The tools allowed are limited to inline comments and gh pr comment/diff/view.
  • Check result: the gate step rejects missing or non-numeric blocking_findings and fails when the count is 1 or more. Each way the job can fail gets its own message in the Explain review failure step, so the messages don't overlap.
  • Testing: these are CI workflows, and the PR description links to manual runs that cover pass, re-run on push, and fail on P1.

Blocking findings: 0

Remove the local review workflows and call furedea/reusable-workflows
instead, as a claude-review job that all-green waits for.

Closes #78

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Claude review summary

No blocking findings. The caller-side change is small and looks right:

  • The reusable workflow is pinned to a full commit SHA, and the job gets only contents: read and pull-requests: write.
  • claude-review has no job-level if, so the caller job won't be marked skipped and break all-green. That depends on the reusable workflow's Decide job always succeeding, as the PR description says.
  • Because ci.yml also runs on push to main, a review failure or an outage of the reusable workflow will now turn all-green red there and on PRs. That seems to be intended.

I couldn't check the reusable workflow at fc0cba9 from this environment, so I didn't verify how it handles fork PRs (where secrets are missing) or push events. The checklist in the PR description covers checking that.

🤖 Generated with Claude Code

@furedea
furedea merged commit b9c310f into main Nov 6, 2026
20 checks passed
@furedea
furedea deleted the ci/review-every-pull-request-with-claude branch November 6, 2026 10:49
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.

ci: review every pull request with a reusable claude-code-action workflow

1 participant