Skip to content

Commit 8e58ce8

Browse files
committed
Enhance Claude workflow by adding debugging steps for environment verification, checking for the presence of the 'claude' command, and implementing automatic installation if not found, ensuring smoother execution in CI mode.
1 parent c727a49 commit 8e58ce8

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/actions/claude-code-action/entrypoint.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ set -e
44

55
echo "Running Claude Code in CI mode..."
66

7+
# Debug environment
8+
echo "Current PATH: $PATH"
9+
echo "Available commands:"
10+
which node || echo "node not found"
11+
which npm || echo "npm not found"
12+
which claude || echo "claude not found"
13+
14+
# Check if claude is installed
15+
if ! command -v claude >/dev/null 2>&1; then
16+
echo "Error: claude command not found"
17+
echo "Attempting to install claude..."
18+
npm install -g @anthropic-ai/claude-code || {
19+
echo "Failed to install claude"
20+
exit 1
21+
}
22+
fi
23+
724
# Extract GitHub context and create a smart prompt
825
PROMPT="Analyse the GitHub issue or PR context and generate a smart response based on the repository context."
926

@@ -22,5 +39,6 @@ if [ -z "$ANTHROPIC_API_KEY" ] || [ -z "$GITHUB_TOKEN" ]; then
2239
exit 1
2340
fi
2441

25-
# Run Claude with the prompt
26-
claude -p "$PROMPT"
42+
# Run Claude with explicit path and avoid env issues
43+
echo "Running claude command..."
44+
exec claude -p "$PROMPT"

0 commit comments

Comments
 (0)