Skip to content

Commit 652d353

Browse files
committed
Simplify action: remove Bedrock support, remove unused params, use Claude CLI directly, remove index.js
1 parent d6f2ea2 commit 652d353

File tree

4 files changed

+28
-189
lines changed

4 files changed

+28
-189
lines changed

README.md

Lines changed: 21 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
# Claude Code GitHub Action
22

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.
44

55
## Features
66

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
1211

1312
## Usage
1413

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:
1815

1916
```yaml
2017
name: Claude Code Integration
@@ -45,70 +42,45 @@ jobs:
4542
echo "feedback=$FEEDBACK" >> $GITHUB_OUTPUT
4643
4744
- 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
4946
with:
5047
mode: 'review'
5148
pr-number: ${{ steps.pr.outputs.number }}
5249
feedback: ${{ steps.pr.outputs.feedback }}
5350
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
5451
github-token: ${{ secrets.GITHUB_TOKEN }}
55-
model-id: 'claude-3-7-sonnet-20250219'
5652
```
5753
58-
## Configuration Options
54+
## Configuration
5955
6056
| Input | Description | Required | Default |
6157
|-------|-------------|----------|---------|
62-
| `mode` | Operation mode (review, direct) | Yes | `review` |
58+
| `mode` | Operation mode (review or direct) | Yes | `review` |
6359
| `pr-number` | Pull request number | Yes* | |
6460
| `feedback` | User query text | Yes | |
6561
| `anthropic-api-key` | Anthropic API key | Yes | |
6662
| `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` |
7264

73-
\* Required if mode is `review`
65+
\* Required when mode is 'review'
7466

7567
## Example Queries
7668

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:
7870

7971
- `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?`
10476

10577
## How It Works
10678

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
11284
6. The response is posted as a comment on the PR
11385

11486
## Permissions

action.yml

Lines changed: 5 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,8 @@ inputs:
2121
github-token:
2222
description: 'GitHub token for API access'
2323
required: true
24-
model-id:
25-
description: 'Claude model ID to use'
26-
required: false
27-
default: 'claude-3-7-sonnet-20250219'
28-
use-bedrock:
29-
description: 'Whether to use AWS Bedrock for Claude access'
30-
required: false
31-
default: 'false'
32-
max-tokens:
33-
description: 'Maximum tokens to generate in the response'
34-
required: false
35-
default: '4096'
36-
temperature:
37-
description: 'Temperature for generation'
38-
required: false
39-
default: '0.7'
4024
output-file:
41-
description: 'Path to write the output to'
25+
description: 'Path to write the output to (for direct mode)'
4226
required: false
4327
default: 'claude-code-output'
4428

@@ -64,24 +48,6 @@ runs:
6448
# Set Anthropic API key
6549
export ANTHROPIC_API_KEY="${{ inputs.anthropic-api-key }}"
6650
67-
# Set up AWS environment if using Bedrock
68-
if [[ "${{ inputs.use-bedrock }}" == "true" ]]; then
69-
if [[ -n "${{ env.BEDROCK_AWS_ACCESS_KEY_ID }}" && -n "${{ env.BEDROCK_AWS_SECRET_ACCESS_KEY }}" ]]; then
70-
mkdir -p ~/.aws
71-
cat > ~/.aws/credentials << EOF
72-
[default]
73-
aws_access_key_id = ${{ env.BEDROCK_AWS_ACCESS_KEY_ID }}
74-
aws_secret_access_key = ${{ env.BEDROCK_AWS_SECRET_ACCESS_KEY }}
75-
EOF
76-
if [[ -n "${{ env.BEDROCK_AWS_REGION }}" ]]; then
77-
cat > ~/.aws/config << EOF
78-
[default]
79-
region = ${{ env.BEDROCK_AWS_REGION }}
80-
EOF
81-
fi
82-
fi
83-
fi
84-
8551
# Create a temp file for Claude's response
8652
RESPONSE_FILE=$(mktemp)
8753
@@ -137,19 +103,9 @@ runs:
137103
EOF
138104
)
139105
140-
# Set up the Claude command
141-
CLAUDE_CMD="claude"
142-
CLAUDE_CMD+=" --model ${{ inputs.model-id }}"
143-
CLAUDE_CMD+=" --max-tokens ${{ inputs.max-tokens }}"
144-
CLAUDE_CMD+=" --temperature ${{ inputs.temperature }}"
145-
146-
if [[ "${{ inputs.use-bedrock }}" == "true" ]]; then
147-
CLAUDE_CMD+=" --provider bedrock"
148-
fi
149-
150-
# Run Claude and capture output
106+
# Run Claude CLI
151107
echo "Sending request to Claude..."
152-
echo "$PROMPT" | $CLAUDE_CMD -p - > "$RESPONSE_FILE"
108+
echo "$PROMPT" | claude -p - > "$RESPONSE_FILE"
153109
154110
# Post response as PR comment
155111
echo "Posting Claude's response as PR comment"
@@ -167,36 +123,8 @@ runs:
167123
# Set Anthropic API key
168124
export ANTHROPIC_API_KEY="${{ inputs.anthropic-api-key }}"
169125
170-
# Set up AWS environment if using Bedrock
171-
if [[ "${{ inputs.use-bedrock }}" == "true" ]]; then
172-
if [[ -n "${{ env.BEDROCK_AWS_ACCESS_KEY_ID }}" && -n "${{ env.BEDROCK_AWS_SECRET_ACCESS_KEY }}" ]]; then
173-
mkdir -p ~/.aws
174-
cat > ~/.aws/credentials << EOF
175-
[default]
176-
aws_access_key_id = ${{ env.BEDROCK_AWS_ACCESS_KEY_ID }}
177-
aws_secret_access_key = ${{ env.BEDROCK_AWS_SECRET_ACCESS_KEY }}
178-
EOF
179-
if [[ -n "${{ env.BEDROCK_AWS_REGION }}" ]]; then
180-
cat > ~/.aws/config << EOF
181-
[default]
182-
region = ${{ env.BEDROCK_AWS_REGION }}
183-
EOF
184-
fi
185-
fi
186-
fi
187-
188-
# Set up the Claude command
189-
CLAUDE_CMD="claude"
190-
CLAUDE_CMD+=" --model ${{ inputs.model-id }}"
191-
CLAUDE_CMD+=" --max-tokens ${{ inputs.max-tokens }}"
192-
CLAUDE_CMD+=" --temperature ${{ inputs.temperature }}"
193-
194-
if [[ "${{ inputs.use-bedrock }}" == "true" ]]; then
195-
CLAUDE_CMD+=" --provider bedrock"
196-
fi
197-
198-
# Run Claude and capture output
126+
# Run Claude CLI and capture output
199127
echo "Sending request to Claude..."
200-
echo "${{ inputs.feedback }}" | $CLAUDE_CMD -p - > "${{ inputs.output-file }}"
128+
echo "${{ inputs.feedback }}" | claude -p - > "${{ inputs.output-file }}"
201129
202130
echo "Claude's response written to ${{ inputs.output-file }}"

index.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "claude-code-github-action",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "GitHub action for Claude Code Integration in PR comments and reviews",
5-
"main": "run.js",
5+
"main": "index.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},

0 commit comments

Comments
 (0)