Skip to content

ci(claude): switch Claude Code actions to ANTHROPIC_API_KEY#3532

Merged
ericallam merged 2 commits intomainfrom
ci/claude-actions-api-key
May 7, 2026
Merged

ci(claude): switch Claude Code actions to ANTHROPIC_API_KEY#3532
ericallam merged 2 commits intomainfrom
ci/claude-actions-api-key

Conversation

@ericallam
Copy link
Copy Markdown
Member

Summary

Both Claude Code workflows (claude.yml and claude-md-audit.yml) authenticated via CLAUDE_CODE_OAUTH_TOKEN, which broke when the org disabled Claude subscription access for Claude Code:

Your organization has disabled Claude subscription access for Claude Code · Use an Anthropic API key instead, or ask your admin to enable access

This switches both workflows to anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} (secret already added to the repo).

Test plan

  • Confirm 📝 CLAUDE.md Audit runs to completion on this PR
  • Confirm @claude mention in a PR comment still triggers the Claude Code workflow successfully

The org disabled Claude subscription access for Claude Code, breaking
both Claude workflows that authenticated via CLAUDE_CODE_OAUTH_TOKEN.
Switch them to the new ANTHROPIC_API_KEY repo secret so the audit and
@claude-mention workflows authenticate via API key instead.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

⚠️ No Changeset found

Latest commit: e20980d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 44332f07-ad71-4a71-915d-f8911b21eabc

📥 Commits

Reviewing files that changed from the base of the PR and between 396d300 and e20980d.

📒 Files selected for processing (1)
  • .github/workflows/claude.yml
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/claude.yml
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (30)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
  • GitHub Check: sdk-compat / Deno Runtime
  • GitHub Check: sdk-compat / Bun Runtime
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: sdk-compat / Cloudflare Workers
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript-typescript)

Walkthrough

This pull request updates the authentication mechanism for the Claude Code action across two GitHub Actions workflow files. Both .github/workflows/claude-md-audit.yml and .github/workflows/claude.yml are modified to replace the claude_code_oauth_token secret input with anthropic_api_key, sourced from secrets.ANTHROPIC_API_KEY. All other workflow behavior, including trigger conditions, permissions, job steps, and Claude-specific arguments, remains unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes problem context and the solution, but is missing several required template sections including the checklist, explicit confirmation of following the contributing guide, and proper formatting with all template sections. Complete the PR description by including all template sections: the checklist with boxes, explicit statement about following the contributing guide, and Testing/Changelog sections formatted as specified in the template.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: switching Claude Code actions from CLAUDE_CODE_OAUTH_TOKEN to ANTHROPIC_API_KEY authentication.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/claude-actions-api-key

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread .github/workflows/claude.yml
Comment thread .github/workflows/claude.yml
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/claude.yml (1)

15-19: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Gate secret-backed runs to trusted actors before using ANTHROPIC_API_KEY.

Line 55 now uses a billable API key, but Lines 15-19 still allow any @claude mention path to trigger the job. On public repos, this can enable untrusted trigger abuse. Add author-association checks (or an equivalent trust gate) to the job if.

Suggested hardening diff
   claude:
     if: |
       (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
       (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
       (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
-      (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
+      (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
+      &&
+      (
+        (github.event_name == 'issue_comment' && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) ||
+        (github.event_name == 'pull_request_review_comment' && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) ||
+        (github.event_name == 'pull_request_review' && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.review.author_association)) ||
+        (github.event_name == 'issues' && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association))
+      )

Also applies to: 55-55

🤖 Prompt for 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.

In @.github/workflows/claude.yml around lines 15 - 19, The current job
if-condition allows any `@claude` mention to trigger a run that later uses
ANTHROPIC_API_KEY; tighten the gate by adding author-association checks to the
boolean expression so only trusted actors can trigger secret-backed runs—e.g.,
augment each branch that checks contains(..., '@claude') with an additional
check on the corresponding author association
(github.event.comment.author_association,
github.event.review.author_association, github.event.issue.author_association or
github.event.pull_request.author_association) to require values like 'OWNER' ||
'MEMBER' || 'COLLABORATOR' (or another chosen trusted set); update the combined
if to AND the mention check with the author_association check so untrusted
mentions cannot trigger the job that uses ANTHROPIC_API_KEY.
🤖 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.

Outside diff comments:
In @.github/workflows/claude.yml:
- Around line 15-19: The current job if-condition allows any `@claude` mention to
trigger a run that later uses ANTHROPIC_API_KEY; tighten the gate by adding
author-association checks to the boolean expression so only trusted actors can
trigger secret-backed runs—e.g., augment each branch that checks contains(...,
'@claude') with an additional check on the corresponding author association
(github.event.comment.author_association,
github.event.review.author_association, github.event.issue.author_association or
github.event.pull_request.author_association) to require values like 'OWNER' ||
'MEMBER' || 'COLLABORATOR' (or another chosen trusted set); update the combined
if to AND the mention check with the author_association check so untrusted
mentions cannot trigger the job that uses ANTHROPIC_API_KEY.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ef9ac26b-4913-4f2a-a835-038cb26da288

📥 Commits

Reviewing files that changed from the base of the PR and between 62e0066 and 396d300.

📒 Files selected for processing (2)
  • .github/workflows/claude-md-audit.yml
  • .github/workflows/claude.yml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (32)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: sdk-compat / Cloudflare Workers
  • GitHub Check: sdk-compat / Deno Runtime
  • GitHub Check: sdk-compat / Bun Runtime
  • GitHub Check: audit
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (python)
🔇 Additional comments (1)
.github/workflows/claude-md-audit.yml (1)

39-39: Auth input migration looks correct here.

Line 39 is a clean swap to anthropic_api_key, and this workflow is already constrained to same-repo PRs (Lines 20-21), which keeps exposure controlled.

The official anthropics/claude-code-action example for anthropic_api_key
requires contents/pull-requests/issues: write so the action can comment
back on @claude mentions and push when Edit/Write tools are enabled.
Bring claude.yml in line with claude-md-audit.yml (which already had
PR/issue write) and the upstream examples/claude.yml.

Resolves Devin review feedback BUG-0001 + ANALYSIS-0002 on PR 3532.
@ericallam ericallam merged commit 3e6458f into main May 7, 2026
44 of 45 checks passed
@ericallam ericallam deleted the ci/claude-actions-api-key branch May 7, 2026 10:53
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.

2 participants