fix: Match working CLI syntax from contributor.info repo
- Pin CLI version to @continuedev/cli@1.4.30 (known working version) - Use correct syntax: cn --config 'org/assistant' instead of --org/--config - Use file-based prompt with @filename syntax for better handling - Add --allow Bash flag to enable shell commands in reviews - Increase timeout to 240 seconds (4 minutes) for complex reviews - Remove timeout from version check to avoid false failures These changes match the working implementation in bdougie/contributor.info
This commit is contained in:
parent
6c8c6ca9d9
commit
a4f3db0804
2 changed files with 24 additions and 10 deletions
|
|
@ -73,7 +73,7 @@ runs:
|
|||
- name: Install Continue CLI
|
||||
if: env.SKIP_REVIEW != 'true'
|
||||
shell: bash
|
||||
run: npm install -g @continuedev/cli@latest
|
||||
run: npm install -g @continuedev/cli@1.4.30
|
||||
|
||||
- name: Build Inline Review Prompt
|
||||
if: env.SKIP_REVIEW != 'true'
|
||||
|
|
@ -219,7 +219,7 @@ runs:
|
|||
# Test Continue CLI availability
|
||||
if [ "$SKIP_CLI" != "true" ]; then
|
||||
echo "Testing Continue CLI..."
|
||||
if ! timeout 10 cn --version; then
|
||||
if ! cn --version; then
|
||||
echo "Warning: Continue CLI not found or not working"
|
||||
cat > inline_review.json << 'EOF'
|
||||
{
|
||||
|
|
@ -228,14 +228,21 @@ runs:
|
|||
}
|
||||
EOF
|
||||
echo "SKIP_CLI=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Continue CLI version: $(cn --version)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run the CLI and capture JSON output with error handling
|
||||
if [ "$SKIP_CLI" != "true" ]; then
|
||||
echo "Executing Continue CLI with org: ${{ inputs.continue-org }}, config: ${{ inputs.continue-config }}"
|
||||
# Use timeout to prevent hanging (120 seconds max)
|
||||
if ! timeout 120 cn --readonly --format json --org "${{ inputs.continue-org }}" --config "${{ inputs.continue-config }}" -p "$(cat inline_review_prompt.txt)" > inline_review_raw.json 2>cli_error.log; then
|
||||
echo "Executing Continue CLI with config: ${{ inputs.continue-org }}/${{ inputs.continue-config }}"
|
||||
|
||||
# Write prompt to temp file for better handling
|
||||
PROMPT_FILE="/tmp/continue-prompt-$.txt"
|
||||
cp inline_review_prompt.txt "$PROMPT_FILE"
|
||||
|
||||
# Use timeout to prevent hanging (240 seconds = 4 minutes)
|
||||
if ! timeout 240 cn --config "${{ inputs.continue-org }}/${{ inputs.continue-config }}" -p "@$PROMPT_FILE" --allow Bash --format json > inline_review_raw.json 2>cli_error.log; then
|
||||
echo "Warning: Continue CLI command failed"
|
||||
echo "CLI error log:"
|
||||
cat cli_error.log
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ runs:
|
|||
- name: Install Continue CLI
|
||||
if: env.SHOULD_RUN == 'true'
|
||||
shell: bash
|
||||
run: npm install -g @continuedev/cli@latest
|
||||
run: npm install -g @continuedev/cli@1.4.30
|
||||
|
||||
- name: Build PR Review Prompt
|
||||
if: env.SHOULD_RUN == 'true'
|
||||
|
|
@ -189,7 +189,7 @@ EOF
|
|||
# Test Continue CLI availability
|
||||
if [ "$SKIP_CLI" != "true" ]; then
|
||||
echo "Testing Continue CLI..."
|
||||
if ! timeout 10 cn --version; then
|
||||
if ! cn --version; then
|
||||
echo "Warning: Continue CLI not found or not working"
|
||||
cat > code_review.md << 'EOF'
|
||||
## Code Review Summary
|
||||
|
|
@ -201,14 +201,21 @@ EOF
|
|||
- Verify @continuedev/cli package is available
|
||||
EOF
|
||||
echo "SKIP_CLI=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Continue CLI version: $(cn --version)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run the CLI with validated config and error handling
|
||||
if [ "$SKIP_CLI" != "true" ]; then
|
||||
echo "Executing Continue CLI with org: $CONTINUE_ORG, config: $CONTINUE_CONFIG"
|
||||
# Use timeout to prevent hanging (120 seconds max)
|
||||
if ! timeout 120 cn --readonly --org "$CONTINUE_ORG" --config "$CONTINUE_CONFIG" -p "$(cat review_prompt.txt)" > code_review.md 2>cli_error.log; then
|
||||
echo "Executing Continue CLI with config: $CONTINUE_ORG/$CONTINUE_CONFIG"
|
||||
|
||||
# Write prompt to temp file for better handling
|
||||
PROMPT_FILE="/tmp/continue-prompt-$.txt"
|
||||
cp review_prompt.txt "$PROMPT_FILE"
|
||||
|
||||
# Use timeout to prevent hanging (240 seconds = 4 minutes)
|
||||
if ! timeout 240 cn --config "$CONTINUE_ORG/$CONTINUE_CONFIG" -p "@$PROMPT_FILE" --allow Bash > code_review.md 2>cli_error.log; then
|
||||
echo "Error: Continue CLI command failed"
|
||||
echo "CLI error log:"
|
||||
cat cli_error.log
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue