-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: clean up stale lock files and validate installation #742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -202,6 +202,10 @@ runs: | |||||||||||||||||||||||
| echo "Installing Claude Code v${CLAUDE_CODE_VERSION}..." | ||||||||||||||||||||||||
| for attempt in 1 2 3; do | ||||||||||||||||||||||||
| echo "Installation attempt $attempt..." | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Clean up stale lock files before retry | ||||||||||||||||||||||||
| rm -rf ~/.claude/.locks 2>/dev/null || true | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if command -v timeout &> /dev/null; then | ||||||||||||||||||||||||
| timeout 120 bash -c "curl -fsSL https://claude.ai/install.sh | bash -s -- $CLAUDE_CODE_VERSION" && break | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
|
|
@@ -214,8 +218,15 @@ runs: | |||||||||||||||||||||||
| echo "Installation failed, retrying..." | ||||||||||||||||||||||||
| sleep 5 | ||||||||||||||||||||||||
| done | ||||||||||||||||||||||||
| echo "Claude Code installed successfully" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Add to PATH and validate installation | ||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation: The comment "Add to PATH and validate installation" is slightly misleading since the PATH setup already existed before this PR. Consider updating to better reflect that this is primarily adding validation:
Suggested change
|
||||||||||||||||||||||||
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | ||||||||||||||||||||||||
| export PATH="$HOME/.local/bin:$PATH" | ||||||||||||||||||||||||
| if ! command -v claude &> /dev/null; then | ||||||||||||||||||||||||
| echo "Installation failed: claude binary not found in PATH" | ||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
Comment on lines
+225
to
+228
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enhancement: Consider adding debugging context to help diagnose installation failures in CI logs:
Suggested change
|
||||||||||||||||||||||||
| echo "Claude Code installed successfully" | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
| echo "Using custom Claude Code executable: $PATH_TO_CLAUDE_CODE_EXECUTABLE" | ||||||||||||||||||||||||
| # Add the directory containing the custom executable to PATH | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -128,6 +128,10 @@ runs: | |||||||||||||||||||||||||||||||
| echo "Installing Claude Code v${CLAUDE_CODE_VERSION}..." | ||||||||||||||||||||||||||||||||
| for attempt in 1 2 3; do | ||||||||||||||||||||||||||||||||
| echo "Installation attempt $attempt..." | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Clean up stale lock files before retry | ||||||||||||||||||||||||||||||||
| rm -rf ~/.claude/.locks 2>/dev/null || true | ||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Performance & Logic Optimization: Same as in action.yml - consider moving lock cleanup to only execute after failures, not before the first attempt.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The lock cleanup path may need adjustment. Community workarounds in issue #709 report success with ~/.local/state/claude/locks rather than ~/.claude/.locks. From the comments:
Consider cleaning both paths to cover different Claude Code versions: rm -rf ~/.local/state/claude/locks 2>/dev/null || true |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if command -v timeout &> /dev/null; then | ||||||||||||||||||||||||||||||||
| timeout 120 bash -c "curl -fsSL https://claude.ai/install.sh | bash -s -- $CLAUDE_CODE_VERSION" && break | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
|
|
@@ -140,6 +144,14 @@ runs: | |||||||||||||||||||||||||||||||
| echo "Installation failed, retrying..." | ||||||||||||||||||||||||||||||||
| sleep 5 | ||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Add to PATH and validate installation | ||||||||||||||||||||||||||||||||
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | ||||||||||||||||||||||||||||||||
| export PATH="$HOME/.local/bin:$PATH" | ||||||||||||||||||||||||||||||||
| if ! command -v claude &> /dev/null; then | ||||||||||||||||||||||||||||||||
| echo "Installation failed: claude binary not found in PATH" | ||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
| echo "Claude Code installed successfully" | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
| echo "Using custom Claude Code executable: $PATH_TO_CLAUDE_CODE_EXECUTABLE" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performance & Logic Optimization: Consider moving the lock cleanup to only execute after a failed attempt rather than before every attempt (including the first). This would be more logically correct since locks only exist after a timeout/failure.