fix(ci): claude.yml テンプレートに認証ガードを追加し未設定時のCI失敗を防止 - #1045
Conversation
認証シークレット未設定時に anthropics/claude-code-action が検証エラーで失敗する問題を テンプレート側で恒久対応。claude-code-review.yml と同じ Check Claude authentication ステップを追加し、未設定時は Run Claude Code を skip して job を成功(緑)にする。 downstream 同期でOYKOT等の全リポに伝播する。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Claude workflow checks OAuth, API-key, and paired federation credentials. It exposes authentication availability through a step output. Claude execution now requires available authentication and a draft pull request. ChangesClaude authentication gating
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e766486ee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if: steps.claude-auth.outputs.available == 'true' | ||
| if: steps.pr_draft.outputs.is_draft != 'true' |
There was a problem hiding this comment.
Merge the authentication and draft conditions
The newly added if duplicates the existing if key in the same step. prettier --check .github/workflows/claude.yml reports Map keys must be unique, so GitHub cannot load this workflow and every @claude trigger is disabled; combine both predicates into one expression.
Useful? React with 👍 / 👎.
| [ -n "$ANTHROPIC_API_KEY" ] || | ||
| { [ -n "$ANTHROPIC_FEDERATION_RULE_ID" ] && [ -n "$ANTHROPIC_ORGANIZATION_ID" ]; }; then |
There was a problem hiding this comment.
Forward every accepted credential to the action
When a downstream repository has only ANTHROPIC_API_KEY or federation credentials, this guard emits available=true, but those variables are scoped to the shell step and the action still receives only claude_code_oauth_token. The analogous .github/workflows/claude-code-review.yml explicitly supplies all three action inputs, so these configurations will still fail authentication instead of being handled as promised.
Useful? React with 👍 / 👎.
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Check Claude authentication |
There was a problem hiding this comment.
Update the distributable workflow template too
This changes only the runnable workflow while templates/workflows/claude.yml remains unchanged. The checked script/check-workflow-template-sync.js treats that template as the source paired with this file, and npm run workflow:sync:check now fails; moreover, downstream synchronization will continue distributing the unguarded template, so the intended organization-wide fix will not propagate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/claude.yml:
- Around line 99-101: Merge the duplicate conditions on the “Run Claude Code”
workflow step into its existing single if expression, combining both predicates
with the appropriate logical operator. Remove the extra if key while preserving
both conditions and the step’s current behavior.
- Around line 90-92: Remove the duplicate if condition from the Run Claude Code
step and replace it with one combined condition requiring both
steps.claude-auth.outputs.available and steps.pr_draft.outputs.is_draft to
indicate the step should run, preserving the intended draft and authentication
gating.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: abcb3dad-7fae-4598-a1a3-5347f8294f25
📒 Files selected for processing (1)
.github/workflows/claude.yml
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.131.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Why
認証シークレット (
CLAUDE_CODE_OAUTH_TOKEN/ANTHROPIC_API_KEY/ federation) が未設定のリポジトリで、@claudeトリガーのたびにanthropics/claude-code-actionがEnvironment variable validation failedで失敗し、GitHub Actions が赤くなっていた。OYKOT-jp 組織横断で多発。What
テンプレート
claude.ymlにclaude-code-review.ymlと同じCheck Claude authenticationステップを追加し、Run Claude Codeをif: steps.claude-auth.outputs.available == 'true'でガード。未設定時は skip(job成功=緑)になる。How
downstream-template-auto-sync(ADR 0019)で各リポに伝播。既にOYKOT-jpの36リポには同等のガードを個別適用済みで、本PRはテンプレート正本を追従させ新規リポでの再発を防ぐもの。
Risk
低。トークン設定済みリポは従来どおり稼働、未設定リポは fail→skip に変わるのみ。YAML構文検証済み。
🤖 Generated with Claude Code
Summary by CodeRabbit