chore(ci): scope ANTHROPIC_API_KEY to claude-code environment#847
Open
chore(ci): scope ANTHROPIC_API_KEY to claude-code environment#847
Conversation
Adds `environment: claude-code` to the claude job so that the ANTHROPIC_API_KEY secret can be scoped to a GitHub environment with branch restrictions, adding defense-in-depth against secret exposure on unreviewed feature branch workflows. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Coverage Report
File CoverageNo changed files found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scopes the
ANTHROPIC_API_KEYsecret to a GitHub environment (claude-code) with branch restrictions, adding defense-in-depth against secret exposure from unreviewed feature branch workflows.Changes
environment: claude-codeto theclaudejob in.github/workflows/claude.ymlManual steps required (not automated)
After merging, complete the GitHub settings:
claude-codemain: Deployment branches and tags → Selected branches and tags → add patternmainANTHROPIC_API_KEYunder the new environment's secrets, then delete the repo-level secret from Settings → Secrets and variables → ActionsTesting
The change is verified by confirming that
@claudecomments on PRs/issues continue to work after the GitHub settings steps are completed. Theissue_comment/pull_request_review_commentevent types already run from the default branch, so existing behavior is unchanged.🤖 Generated with Claude Code
Note
Low Risk
Single-line CI workflow change; main risk is misconfigured GitHub environment/secrets causing the Claude job to lose access to
ANTHROPIC_API_KEY.Overview
Scopes the
claudeGitHub Actions job to run in theclaude-codeenvironment by addingenvironment: claude-codeto.github/workflows/claude.yml, enabling environment-level secret/branch restrictions forANTHROPIC_API_KEY.Written by Cursor Bugbot for commit 77acf22. This will update automatically on new commits. Configure here.