Repository navigation
ci: give the @claude mention handler a review-sized budget #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: allxsmith/bestax
Length of output: 12420
🌐 Web query:
anthropics/claude-code-action gh pr view GH_TOKEN GITHUB_TOKEN allowlisted Bash tools token handling💡 Result:
Claude Code interacts with GitHub through the GitHub CLI (gh) and the
anthropic/claude-code-actionin GitHub Actions. Managing token authentication and tool permissions effectively is critical for these workflows. ### Token Handling and Precedence TheghCLI follows a specific order of precedence for authentication, which can lead to conflicts if not managed correctly [1][2][3]. * Precedence: The CLI prioritizesGH_TOKENoverGITHUB_TOKEN[1][2]. * Injection Conflict: Claude Code historically injected aGITHUB_TOKEN(often a Personal Access Token) directly into the environment of the Bash tool. This could override OAuth tokens stored in the system's local keychain, causing authentication failures or unexpected behavior when usingghcommands [3]. * Best Practice: In CI/CD workflows, it is recommended to explicitly setGH_TOKENin the environment to ensure theghCLI uses the intended credentials [1][2]. For example: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} [2] ### Bash Tools and Permission Management Claude Code uses an allowlist/denylist permission system to control access to Bash commands [4][5][6]. * Allowlisting: You can add specific commands topermissions.allowto permit them without manual approval [4]. * Sandboxing: WhenautoAllowBashIfSandboxedis enabled (default), commands running within a sandbox boundary are automatically allowed, bypassing the standard prompt for most Bash tools [4][5]. * Security Risks: * Compound Commands: Relying on simple allowlists can be risky because compound commands (e.g.,cmd1 && cmd2) might bypass permission filters if only the first token is evaluated [7]. * Command Parsing: Claude Code parses commands into an Abstract Syntax Tree (AST) to match against rules. Commands that cannot be parsed safely or do not match an allowlist entry trigger manual approval [6]. * Credential Masking: To prevent credentials from being exposed, use themaskmode in sandbox settings. This protects the environment variable while allowing tools (likeghornpm) to remain functional [8]. ### Specific GitHub Actions Considerations Theclaude-code-actionis designed to run on your infrastructure [9]. It intelligently selects execution modes and can be configured to use specific secrets for authentication [10][9]. When using features likegh pr view, be aware that automated polling or frequent executions can trigger high CPU usage or bypass intended permission constraints if not properly cached [11][12]. To mitigate this, ensure your configuration balances automation needs with resource and security constraints [12][6].Citations:
gh pr viewpolling bypasses the permission system and cannot be disabled anthropics/claude-code#23580🌐 Web query:
anthropics/claude-code-action README GH_TOKEN github_token claude_code_oauth_token gh CLI authentication💡 Result:
In Claude Code, authentication is separated into two primary domains: Anthropic API access and GitHub repository access. 1. Anthropic/Claude Code Authentication The CLAUDE_CODE_OAUTH_TOKEN is used for long-lived authentication to Claude Code itself, particularly in CI/CD or non-interactive environments where a browser-based login is not possible [1][2]. You can generate this token by running the command 'claude setup-token' locally in your terminal [3][2]. Once generated, set this token as the CLAUDE_CODE_OAUTH_TOKEN environment variable in your CI/CD configuration or environment [2]. 2. GitHub CLI (gh) and Repository Authentication Claude Code uses the GitHub CLI ('gh') to interact with repositories [4][5]. To authenticate GitHub operations, Claude Code looks for a GitHub token in the following order [6]: - Provider-specific environment variables - GH_TOKEN - GITHUB_TOKEN - 'gh auth token' (retrieved from the local GitHub CLI configuration) [6] For GitHub Actions workflows, it is best practice to pass the 'GITHUB_TOKEN' (provided automatically by the workflow) to the 'claude-code-action' [4]. In your workflow file, you can explicitly map this token: - name: Run Claude Code uses: anthropics/claude-code-action@beta env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: github_token: ${{ secrets.GITHUB_TOKEN }} #... other configuration [7][8] When running Claude Code locally, you can authenticate the GitHub CLI by running 'gh auth login' [4][6]. This stores your credentials securely, and Claude Code will automatically detect and use them [5][1]. If you need to run Claude Code in a headless or CI environment, setting the 'GH_TOKEN' or 'GITHUB_TOKEN' environment variable directly is the standard method for providing repository-level credentials [4][6].
Citations:
CLAUDE_CODE_OAUTH_TOKENanthropics/claude-code#51784Pass
GH_TOKENinto the Claude stepBash(gh pr view:*)andBash(gh pr diff:*)need a GitHub token. This step only setsclaude_code_oauth_token, so addGH_TOKEN: ${{ secrets.GITHUB_TOKEN }}(orgithub_token) here to avoid auth failures and wasted turns.🤖 Prompt for AI Agents