Skip to content

Commit 798cf09

Browse files
ashwin-antclaude
andauthored
chore: add retry loop to Claude Code installation (#694)
* chore: add --debug and retry loop to Claude Code installation Adds 2-minute timeout with up to 3 retry attempts for installation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: remove unsupported --debug flag from install script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8458f43 commit 798cf09

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,19 @@ runs:
196196
# Install Claude Code if no custom executable is provided
197197
if [ -z "${{ inputs.path_to_claude_code_executable }}" ]; then
198198
echo "Installing Claude Code..."
199-
curl -fsSL https://claude.ai/install.sh | bash -s 2.0.50
199+
for attempt in 1 2 3; do
200+
echo "Installation attempt $attempt..."
201+
if timeout 120 bash -c 'curl -fsSL https://claude.ai/install.sh | bash -s -- 2.0.50'; then
202+
echo "Claude Code installed successfully"
203+
break
204+
fi
205+
if [ $attempt -eq 3 ]; then
206+
echo "Failed to install Claude Code after 3 attempts"
207+
exit 1
208+
fi
209+
echo "Installation timed out or failed, retrying..."
210+
sleep 5
211+
done
200212
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
201213
else
202214
echo "Using custom Claude Code executable: ${{ inputs.path_to_claude_code_executable }}"

base-action/action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,19 @@ runs:
118118
run: |
119119
if [ -z "${{ inputs.path_to_claude_code_executable }}" ]; then
120120
echo "Installing Claude Code..."
121-
curl -fsSL https://claude.ai/install.sh | bash -s 2.0.50
121+
for attempt in 1 2 3; do
122+
echo "Installation attempt $attempt..."
123+
if timeout 120 bash -c 'curl -fsSL https://claude.ai/install.sh | bash -s -- 2.0.50'; then
124+
echo "Claude Code installed successfully"
125+
break
126+
fi
127+
if [ $attempt -eq 3 ]; then
128+
echo "Failed to install Claude Code after 3 attempts"
129+
exit 1
130+
fi
131+
echo "Installation timed out or failed, retrying..."
132+
sleep 5
133+
done
122134
else
123135
echo "Using custom Claude Code executable: ${{ inputs.path_to_claude_code_executable }}"
124136
# Add the directory containing the custom executable to PATH

0 commit comments

Comments
 (0)