mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
- 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>
118 lines
3.7 KiB
YAML
118 lines
3.7 KiB
YAML
name: Claude Code Action Mode Examples
|
|
|
|
on:
|
|
# Example 1: Tag mode (default) - traditional implementation triggered by mentions
|
|
issue_comment:
|
|
types: [created]
|
|
issues:
|
|
types: [opened, assigned, labeled]
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
pull_request_review_comment:
|
|
types: [created]
|
|
pull_request_review:
|
|
types: [submitted]
|
|
|
|
# Example 2: Agent mode - for scheduled tasks and automation
|
|
schedule:
|
|
- cron: "0 0 * * 1" # Weekly on Monday
|
|
workflow_dispatch:
|
|
inputs:
|
|
task:
|
|
description: "Task for Claude to perform"
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
# Example 1: Tag mode (default) - triggered by @claude mentions
|
|
claude-tag-mode:
|
|
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: anthropics/claude-code-action@main
|
|
with:
|
|
# mode defaults to 'tag' - no need to specify
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
# Responds to @claude mentions, assignments, and labels
|
|
# Creates tracking comments showing progress
|
|
# Full implementation capabilities
|
|
|
|
# Example 2: Agent mode - for automation
|
|
claude-agent-scheduled:
|
|
if: github.event_name == 'schedule'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: anthropics/claude-code-action@main
|
|
with:
|
|
mode: agent
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
override_prompt: |
|
|
Check the repository for:
|
|
1. Outdated dependencies in package.json
|
|
2. TODO comments that haven't been addressed
|
|
3. Files that haven't been updated in over 6 months
|
|
|
|
Create an issue summarizing your findings.
|
|
# Always runs - no trigger checking
|
|
# Perfect for scheduled tasks
|
|
|
|
# Example 3: Agent mode with workflow_dispatch
|
|
claude-agent-dispatch:
|
|
if: github.event_name == 'workflow_dispatch'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: anthropics/claude-code-action@main
|
|
with:
|
|
mode: agent
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
override_prompt: |
|
|
Task: ${{ github.event.inputs.task }}
|
|
|
|
Repository: $REPOSITORY
|
|
Triggered by: $TRIGGER_USERNAME
|
|
|
|
Please complete the requested task and provide a summary of what was done.
|
|
|
|
# Example 4: Custom security review with override_prompt
|
|
claude-security-review:
|
|
if: github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'security-review')
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: anthropics/claude-code-action@main
|
|
with:
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
override_prompt: |
|
|
Perform a security review of PR #$PR_NUMBER.
|
|
|
|
Focus on:
|
|
- SQL injection vulnerabilities
|
|
- XSS (Cross-Site Scripting) risks
|
|
- Authentication/authorization issues
|
|
- Sensitive data exposure
|
|
- Input validation problems
|
|
|
|
Changed files:
|
|
$CHANGED_FILES
|
|
|
|
Provide severity ratings (Critical/High/Medium/Low) for any issues found.
|
|
Be specific about file paths and line numbers.
|