Skip to content

Commit 3ed1448

Browse files
km-anthropicclaudeclaude[bot]katchu11
authored
feat: improve examples and migration guide with GitHub context (anthropics#505)
* feat: improve documentation with solutions guide and GitHub context - Add comprehensive solutions.md with 9 complete use case examples - Fix migration guide examples to include required GitHub context - Update examples missing GitHub context (workflow-dispatch-agent, claude-modes) - Enhance README with prominent Solutions & Use Cases section - Document tracking comment behavior change in automation mode - All PR review examples now include REPO and PR NUMBER context Fixes issues reported in discussions anthropics#490 and anthropics#491 where: - Migration examples were dysfunctional without GitHub context - Users lost PR review capability after v0.x migration - Missing explanation of tracking comment removal in agent mode 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: apply prettier formatting to fix CI Co-authored-by: kashyap murali <km-anthropic@users.noreply.github.com> * refactor: streamline examples and remove implementation details - Remove 5 redundant examples (57% reduction: 12→7 files) - Deleted: claude.yml, claude-auto-review.yml, claude-modes.yml, claude-args-example.yml, auto-fix-ci-signed/ - Rename examples for clarity - pr-review-with-tracking.yml → pr-review-comprehensive.yml - claude-pr-path-specific.yml → pr-review-filtered-paths.yml - claude-review-from-author.yml → pr-review-filtered-authors.yml - workflow-dispatch-agent.yml → manual-code-analysis.yml - auto-fix-ci/auto-fix-ci.yml → ci-failure-auto-fix.yml - Update all examples from @V1-Dev to @v1 - Remove implementation details (agent mode references) from docs - Delete obsolete DIY Progress Tracking section - Add track_progress documentation and examples Addresses PR feedback about exposing internal implementation details and consolidates redundant examples into focused, clear use cases. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: apply prettier formatting to fix CI Applied prettier formatting to 3 files to resolve CI formatting issues. Co-authored-by: kashyap murali <km-anthropic@users.noreply.github.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: kashyap murali <km-anthropic@users.noreply.github.com> Co-authored-by: Kashyap Murali <13315300+katchu11@users.noreply.github.com>
1 parent 45408b4 commit 3ed1448

19 files changed

Lines changed: 778 additions & 576 deletions

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,25 @@ This command will guide you through setting up the GitHub app and required secre
3131
- You must be a repository admin to install the GitHub app and add secrets
3232
- This quickstart method is only available for direct Anthropic API users. For AWS Bedrock or Google Vertex AI setup, see [docs/cloud-providers.md](./docs/cloud-providers.md).
3333

34+
## 📚 Solutions & Use Cases
35+
36+
Looking for specific automation patterns? Check our **[Solutions Guide](./docs/solutions.md)** for complete working examples including:
37+
38+
- **🔍 Automatic PR Code Review** - Full review automation
39+
- **📂 Path-Specific Reviews** - Trigger on critical file changes
40+
- **👥 External Contributor Reviews** - Special handling for new contributors
41+
- **📝 Custom Review Checklists** - Enforce team standards
42+
- **🔄 Scheduled Maintenance** - Automated repository health checks
43+
- **🏷️ Issue Triage & Labeling** - Automatic categorization
44+
- **📖 Documentation Sync** - Keep docs updated with code changes
45+
- **🔒 Security-Focused Reviews** - OWASP-aligned security analysis
46+
- **📊 DIY Progress Tracking** - Create tracking comments in automation mode
47+
48+
Each solution includes complete working examples, configuration details, and expected outcomes.
49+
3450
## Documentation
3551

52+
- **[Solutions Guide](./docs/solutions.md)** - **🎯 Ready-to-use automation patterns**
3653
- **[Migration Guide](./docs/migration-guide.md)** - **⭐ Upgrading from v0.x to v1.0**
3754
- [Setup Guide](./docs/setup.md) - Manual setup, custom GitHub apps, and security best practices
3855
- [Usage Guide](./docs/usage.md) - Basic usage, workflow configuration, and input parameters

docs/custom-automations.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
These examples show how to configure Claude to act automatically based on GitHub events. When you provide a `prompt` input, the action automatically runs in agent mode without requiring manual @mentions. Without a `prompt`, it runs in interactive mode, responding to @claude mentions.
44

5+
## Mode Detection & Tracking Comments
6+
7+
The action automatically detects which mode to use based on your configuration:
8+
9+
- **Interactive Mode** (no `prompt` input): Responds to @claude mentions, creates tracking comments with progress indicators
10+
- **Automation Mode** (with `prompt` input): Executes immediately, **does not create tracking comments**
11+
12+
> **Note**: In v1, automation mode intentionally does not create tracking comments by default to reduce noise in automated workflows. If you need progress tracking, use the `track_progress: true` input parameter.
13+
514
## Supported GitHub Events
615

716
This action supports the following GitHub events ([learn more GitHub event triggers](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows)):

docs/migration-guide.md

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,75 @@ The following inputs have been deprecated and replaced:
7474
```yaml
7575
- uses: anthropics/claude-code-action@v1
7676
with:
77-
prompt: "Review this PR for security issues"
77+
prompt: |
78+
REPO: ${{ github.repository }}
79+
PR NUMBER: ${{ github.event.pull_request.number }}
80+
81+
Review this PR for security issues
7882
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
7983
claude_args: |
8084
--model claude-4-0-sonnet-20250805
8185
--allowedTools Edit,Read,Write
8286
```
8387
88+
> **⚠️ Important**: For PR reviews, always include the repository and PR context in your prompt. This ensures Claude knows which PR to review.
89+
90+
### Automation with Progress Tracking (New in v1.0)
91+
92+
**Missing the tracking comments from v0.x agent mode?** The new `track_progress` input brings them back!
93+
94+
In v1.0, automation mode (with `prompt` input) doesn't create tracking comments by default to reduce noise. However, if you need progress visibility, you can use the `track_progress` feature:
95+
96+
**Before (v0.x with tracking):**
97+
98+
```yaml
99+
- uses: anthropics/claude-code-action@beta
100+
with:
101+
mode: "agent"
102+
direct_prompt: "Review this PR for security issues"
103+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
104+
```
105+
106+
**After (v1.0 with tracking):**
107+
108+
```yaml
109+
- uses: anthropics/claude-code-action@v1
110+
with:
111+
track_progress: true # Forces tag mode with tracking comments
112+
prompt: |
113+
REPO: ${{ github.repository }}
114+
PR NUMBER: ${{ github.event.pull_request.number }}
115+
116+
Review this PR for security issues
117+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
118+
```
119+
120+
#### Benefits of `track_progress`
121+
122+
1. **Preserves GitHub Context**: Automatically includes all PR/issue details, comments, and attachments
123+
2. **Brings Back Tracking Comments**: Creates progress indicators just like v0.x agent mode
124+
3. **Works with Custom Prompts**: Your `prompt` is injected as custom instructions while maintaining context
125+
126+
#### Supported Events for `track_progress`
127+
128+
The `track_progress` input only works with these GitHub events:
129+
130+
**Pull Request Events:**
131+
132+
- `opened` - New PR created
133+
- `synchronize` - PR updated with new commits
134+
- `ready_for_review` - Draft PR marked as ready
135+
- `reopened` - Previously closed PR reopened
136+
137+
**Issue Events:**
138+
139+
- `opened` - New issue created
140+
- `edited` - Issue title or body modified
141+
- `labeled` - Label added to issue
142+
- `assigned` - Issue assigned to user
143+
144+
> **Note**: Using `track_progress: true` with unsupported events will cause an error.
145+
84146
### Custom Template with Variables
85147

86148
**Before (v0.x):**
@@ -100,10 +162,16 @@ The following inputs have been deprecated and replaced:
100162
- uses: anthropics/claude-code-action@v1
101163
with:
102164
prompt: |
103-
Analyze PR #${{ github.event.pull_request.number }} in ${{ github.repository }}
104-
Focus on security vulnerabilities in the changed files
165+
REPO: ${{ github.repository }}
166+
PR NUMBER: ${{ github.event.pull_request.number }}
167+
168+
Analyze this pull request focusing on security vulnerabilities in the changed files.
169+
170+
Note: The PR branch is already checked out in the current working directory.
105171
```
106172

173+
> **💡 Tip**: While you can access GitHub context variables in your prompt, it's recommended to use the standard `REPO:` and `PR NUMBER:` format for consistency.
174+
107175
### Environment Variables
108176

109177
**Before (v0.x):**
@@ -244,6 +312,7 @@ You can also pass MCP configuration from a file:
244312
- [ ] Convert `disallowed_tools` to `claude_args` with `--disallowedTools`
245313
- [ ] Move `claude_env` to `settings` JSON format
246314
- [ ] Move `mcp_config` to `claude_args` with `--mcp-config`
315+
- [ ] **Optional**: Add `track_progress: true` if you need tracking comments in automation mode
247316
- [ ] Test workflow in a non-production environment
248317

249318
## Getting Help

0 commit comments

Comments
 (0)