|
1 | 1 | # Claude Code GitHub Action |
2 | 2 |
|
3 | | -This GitHub Action integrates Claude, Anthropic's AI assistant, directly into your development workflow. It enables developers to get AI assistance directly within pull requests without switching contexts. |
| 3 | +This GitHub Action integrates Claude Code in your GitHub workflows, enabling AI-assisted code reviews and responses to PR comments. |
4 | 4 |
|
5 | 5 | ## Features |
6 | 6 |
|
7 | | -- Process user questions in PR comments with the `claude:` prefix |
8 | | -- Analyze PR changes and provide intelligent responses |
9 | | -- Provide rich context to Claude about the repository and PR |
10 | | -- Support for both Anthropic API and AWS Bedrock |
11 | | -- Simple integration with minimal configuration |
| 7 | +- Process PR comments prefixed with "claude:" |
| 8 | +- Provide rich context about the PR to Claude for better responses |
| 9 | +- Simple setup with minimal configuration |
| 10 | +- Uses GitHub CLI and Claude Code CLI for reliability |
12 | 11 |
|
13 | 12 | ## Usage |
14 | 13 |
|
15 | | -### Integration with PR Comments |
16 | | - |
17 | | -Create a workflow that responds to comments starting with "claude:" in your pull requests: |
| 14 | +Create a workflow file that responds to comments containing the "claude:" prefix: |
18 | 15 |
|
19 | 16 | ```yaml |
20 | 17 | name: Claude Code Integration |
@@ -45,70 +42,45 @@ jobs: |
45 | 42 | echo "feedback=$FEEDBACK" >> $GITHUB_OUTPUT |
46 | 43 | |
47 | 44 | - name: Process with Claude Code |
48 | | - uses: fractureinc/claude-code-github-action@v0.1.4 |
| 45 | + uses: fractureinc/claude-code-github-action@v0.1.5 |
49 | 46 | with: |
50 | 47 | mode: 'review' |
51 | 48 | pr-number: ${{ steps.pr.outputs.number }} |
52 | 49 | feedback: ${{ steps.pr.outputs.feedback }} |
53 | 50 | anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }} |
54 | 51 | github-token: ${{ secrets.GITHUB_TOKEN }} |
55 | | - model-id: 'claude-3-7-sonnet-20250219' |
56 | 52 | ``` |
57 | 53 |
|
58 | | -## Configuration Options |
| 54 | +## Configuration |
59 | 55 |
|
60 | 56 | | Input | Description | Required | Default | |
61 | 57 | |-------|-------------|----------|---------| |
62 | | -| `mode` | Operation mode (review, direct) | Yes | `review` | |
| 58 | +| `mode` | Operation mode (review or direct) | Yes | `review` | |
63 | 59 | | `pr-number` | Pull request number | Yes* | | |
64 | 60 | | `feedback` | User query text | Yes | | |
65 | 61 | | `anthropic-api-key` | Anthropic API key | Yes | | |
66 | 62 | | `github-token` | GitHub token | Yes | | |
67 | | -| `model-id` | Claude model ID | No | `claude-3-7-sonnet-20250219` | |
68 | | -| `use-bedrock` | Use AWS Bedrock | No | `false` | |
69 | | -| `max-tokens` | Maximum response tokens | No | `4096` | |
70 | | -| `temperature` | Response temperature | No | `0.7` | |
71 | | -| `output-file` | Output file for direct mode | No | `claude-code-output` | |
| 63 | +| `output-file` | Output file path (for direct mode) | No | `claude-code-output` | |
72 | 64 |
|
73 | | -\* Required if mode is `review` |
| 65 | +\* Required when mode is 'review' |
74 | 66 |
|
75 | 67 | ## Example Queries |
76 | 68 |
|
77 | | -Here are some example queries you can use with the `claude:` prefix: |
| 69 | +Here are some example queries you can use with the claude: prefix: |
78 | 70 |
|
79 | 71 | - `claude: Explain the changes in this PR` |
80 | | -- `claude: Is there any way to optimize this code?` |
81 | | -- `claude: Suggest tests for these changes` |
82 | | -- `claude: Help me understand this algorithm` |
83 | | -- `claude: Review this PR for security issues` |
84 | | - |
85 | | -## Using AWS Bedrock |
86 | | - |
87 | | -To use Claude via AWS Bedrock instead of the Anthropic API: |
88 | | - |
89 | | -```yaml |
90 | | -- name: Process with Claude Code via Bedrock |
91 | | - uses: fractureinc/claude-code-github-action@v0.1.4 |
92 | | - with: |
93 | | - mode: 'review' |
94 | | - pr-number: ${{ steps.pr.outputs.number }} |
95 | | - feedback: ${{ steps.pr.outputs.feedback }} |
96 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
97 | | - model-id: 'anthropic.claude-3-sonnet-20240229-v1:0' |
98 | | - use-bedrock: true |
99 | | - env: |
100 | | - BEDROCK_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
101 | | - BEDROCK_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
102 | | - BEDROCK_AWS_REGION: us-east-1 |
103 | | -``` |
| 72 | +- `claude: Can you suggest improvements to the code?` |
| 73 | +- `claude: Are there any security issues in these changes?` |
| 74 | +- `claude: How would you refactor this to be more maintainable?` |
| 75 | +- `claude: What tests should be added for this code?` |
104 | 76 |
|
105 | 77 | ## How It Works |
106 | 78 |
|
107 | | -1. The action is triggered when a PR comment starting with `claude:` is detected |
108 | | -2. The action extracts the PR number and the query text |
109 | | -3. GitHub CLI is used to fetch detailed information about the PR and repository |
110 | | -4. Claude is provided with rich context about the repository, PR, and files changed |
111 | | -5. Claude processes the query and provides a response |
| 79 | +1. The action is triggered when a comment starting with "claude:" is detected on a PR |
| 80 | +2. The action extracts the PR number and the user's query |
| 81 | +3. Using GitHub CLI, the action fetches comprehensive information about the PR and repository |
| 82 | +4. This rich context is provided to Claude along with the user's query |
| 83 | +5. Claude processes the information and provides a helpful response |
112 | 84 | 6. The response is posted as a comment on the PR |
113 | 85 |
|
114 | 86 | ## Permissions |
|
0 commit comments