fix(ci): resolve self-hosted Claude path dynamically

This commit is contained in:
Tam Nhu Tran
2026-04-01 20:24:52 -04:00
parent 09276518a7
commit 44e2a49650
2 changed files with 24 additions and 8 deletions
+20 -6
View File
@@ -451,15 +451,29 @@ jobs:
exit 0
fi
CLAUDE_PATH="/root/.local/bin/claude"
CANDIDATES=()
if [ ! -x "$CLAUDE_PATH" ]; then
echo "::error::Missing self-hosted Claude executable at $CLAUDE_PATH"
exit 1
if command -v claude >/dev/null 2>&1; then
CANDIDATES+=("$(command -v claude)")
fi
"$CLAUDE_PATH" --version
echo "claude_path=$CLAUDE_PATH" >> "$GITHUB_OUTPUT"
CANDIDATES+=(
"/home/github-runner/.local/bin/claude"
"/root/.local/bin/claude"
)
for CLAUDE_PATH in "${CANDIDATES[@]}"; do
[ -n "$CLAUDE_PATH" ] || continue
if [ -x "$CLAUDE_PATH" ]; then
"$CLAUDE_PATH" --version
echo "claude_path=$CLAUDE_PATH" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "::error::Missing self-hosted Claude executable. Checked: ${CANDIDATES[*]}"
exit 1
- name: Run Claude Code Review
id: claude-review
@@ -22,8 +22,10 @@ describe('ai-review workflow', () => {
const toolchainStep = steps.find((step) => step.id === 'toolchain');
expect(toolchainStep).toBeDefined();
expect(toolchainStep?.name).toBe('Resolve self-hosted Claude executable');
expect(toolchainStep?.run).toContain('CLAUDE_PATH="/root/.local/bin/claude"');
expect(toolchainStep?.run).toContain('Missing self-hosted Claude executable');
expect(toolchainStep?.run).toContain('command -v claude');
expect(toolchainStep?.run).toContain('"/home/github-runner/.local/bin/claude"');
expect(toolchainStep?.run).toContain('"/root/.local/bin/claude"');
expect(toolchainStep?.run).toContain('Missing self-hosted Claude executable. Checked:');
expect(toolchainStep?.run).toContain('echo "claude_path=$CLAUDE_PATH" >> "$GITHUB_OUTPUT"');
const claudeReviewStep = steps.find((step) => step.id === 'claude-review');