-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
58 lines (44 loc) · 1.42 KB
/
docker-entrypoint.sh
File metadata and controls
58 lines (44 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e
# Arguments passed to the container
REPOSITORY="$1"
PR_NUMBER="$2"
# Environment variables expected:
# - GITHUB_TOKEN: GitHub personal access token
# - ANTHROPIC_API_KEY: Anthropic API key
# - PROMPT_CONTENT: The prompt to pass to Claude Code
if [ -z "$REPOSITORY" ]; then
echo "Error: Repository not specified"
exit 1
fi
if [ -z "$PR_NUMBER" ]; then
echo "Error: PR number not specified"
exit 1
fi
if [ -z "$GITHUB_TOKEN" ]; then
echo "Error: GITHUB_TOKEN environment variable not set"
exit 1
fi
if [ -z "$ANTHROPIC_API_KEY" ]; then
echo "Error: ANTHROPIC_API_KEY environment variable not set"
exit 1
fi
echo "=== Cloning repository: $REPOSITORY ==="
# Clone the repository with authentication
git clone "https://${GITHUB_TOKEN}@github.com/${REPOSITORY}.git" repo
cd repo
echo "=== Fetching PR #$PR_NUMBER ==="
# Fetch the PR
git fetch origin "pull/${PR_NUMBER}/head:pr-${PR_NUMBER}"
git checkout "pr-${PR_NUMBER}"
echo "=== PR checked out successfully ==="
echo "=== Running Claude Code ==="
# Run Claude Code with the specified allowed tools
# Using --print flag for non-interactive mode
echo "$PROMPT_CONTENT" | claude \
-p \
--output-format json \
--verbose \
--allowedTools "Bash(git diff:*),Bash(git status:*),Bash(git log:*),Bash(git show:*),Bash(git remote show:*),Read,Glob,Grep,LS,Task" \
--model "claude-sonnet-4-5-20250929";
echo "=== Claude Code finished ==="