mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
feat: add agent mode for automation scenarios (#337)
* feat: add agent mode for automation scenarios - Add agent mode that always triggers without checking for mentions - Implement Mode interface with support for mode-specific tool configuration - Add getAllowedTools() and getDisallowedTools() methods to Mode interface - Simplify tests by combining related test cases - Update documentation and examples to include agent mode - Fix TypeScript imports to prevent circular dependencies Agent mode is designed for automation and workflow_dispatch scenarios where Claude should always run without requiring trigger phrases. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Minor update to readme (from @main to @beta) * Since workflow_dispatch isn't in the base action, update the examples accordingly * minor formatting issue * Update to say beta instead of main * Fix missed tracking comment to be false --------- Co-authored-by: km-anthropic <km-anthropic@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
56
examples/claude-modes.yml
Normal file
56
examples/claude-modes.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Claude Mode Examples
|
||||
|
||||
on:
|
||||
# Common events for both modes
|
||||
issue_comment:
|
||||
types: [created]
|
||||
issues:
|
||||
types: [opened, labeled]
|
||||
pull_request:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
# Tag Mode (Default) - Traditional implementation
|
||||
tag-mode-example:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: anthropics/claude-code-action@beta
|
||||
with:
|
||||
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
# Tag mode (default) behavior:
|
||||
# - Scans for @claude mentions in comments, issues, and PRs
|
||||
# - Only acts when trigger phrase is found
|
||||
# - Creates tracking comments with progress checkboxes
|
||||
# - Perfect for: Interactive Q&A, on-demand code changes
|
||||
|
||||
# Agent Mode - Automation without triggers
|
||||
agent-mode-auto-review:
|
||||
# Automatically review every new PR
|
||||
if: github.event_name == 'pull_request' && github.event.action == 'opened'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
issues: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: anthropics/claude-code-action@beta
|
||||
with:
|
||||
mode: agent
|
||||
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
override_prompt: |
|
||||
Review this PR for code quality. Focus on:
|
||||
- Potential bugs or logic errors
|
||||
- Security concerns
|
||||
- Performance issues
|
||||
|
||||
Provide specific, actionable feedback.
|
||||
# Agent mode behavior:
|
||||
# - NO @claude mention needed - runs immediately
|
||||
# - Enables true automation (impossible with tag mode)
|
||||
# - Perfect for: CI/CD integration, automatic reviews, label-based workflows
|
||||
Reference in New Issue
Block a user