mirror of
https://github.com/coleam00/Archon.git
synced 2025-12-24 02:39:17 -05:00
fix: Restructure fork review workflow to avoid PR branch checkout
- Create isolated review context directory to prevent PR detection - Move diff to changes.patch file in review-context directory - Add explicit REVIEW_INSTRUCTIONS.md file for guidance - Use standard 'prompt' parameter instead of 'override_prompt' - This approach should prevent Claude Action from auto-detecting PR context
This commit is contained in:
60
.github/workflows/claude-review-fork.yml
vendored
60
.github/workflows/claude-review-fork.yml
vendored
@@ -137,53 +137,51 @@ jobs:
|
||||
echo "Created diff for PR #$PR_NUMBER"
|
||||
echo "Diff size: $(wc -l < pr-diff.patch) lines"
|
||||
|
||||
# Create a simple wrapper script to run Claude without PR context
|
||||
- name: Create Claude Execution Script
|
||||
# Create review context file to avoid PR detection
|
||||
- name: Prepare Review Context
|
||||
if: steps.should-continue.outputs.should_continue == 'true'
|
||||
run: |
|
||||
cat > run-claude.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
echo "Running Claude Code Review on pr-diff.patch"
|
||||
# Create a clean review context that won't trigger PR detection
|
||||
mkdir -p review-context
|
||||
cp pr-diff.patch review-context/changes.patch
|
||||
|
||||
# Read the diff file
|
||||
if [ ! -f pr-diff.patch ]; then
|
||||
echo "Error: pr-diff.patch not found"
|
||||
exit 1
|
||||
fi
|
||||
# Create a review instructions file
|
||||
cat > review-context/REVIEW_INSTRUCTIONS.md << 'EOF'
|
||||
# Code Review Task
|
||||
|
||||
# Create a review summary
|
||||
echo "## Claude Code Review for PR #$PR_NUMBER"
|
||||
echo "Diff file contains $(wc -l < pr-diff.patch) lines of changes"
|
||||
echo "Review will be posted as a comment on the PR"
|
||||
You are reviewing changes from PR #${{ env.PR_NUMBER }}.
|
||||
|
||||
## Files to Review
|
||||
- changes.patch - Contains all the code changes
|
||||
|
||||
## Your Task
|
||||
1. Read and analyze the changes.patch file
|
||||
2. Provide a comprehensive code review
|
||||
3. Post your review as a comment on PR #${{ env.PR_NUMBER }}
|
||||
|
||||
## Important
|
||||
- DO NOT attempt to checkout any code
|
||||
- DO NOT fetch from git
|
||||
- Work only with the provided patch file
|
||||
EOF
|
||||
|
||||
chmod +x run-claude.sh
|
||||
|
||||
- name: Run Claude Code Review (Alternative)
|
||||
- name: Run Claude Code Review
|
||||
if: steps.should-continue.outputs.should_continue == 'true'
|
||||
id: claude
|
||||
uses: anthropics/claude-code-action@beta
|
||||
timeout-minutes: 15
|
||||
env:
|
||||
# Make it look like we're not in a PR context
|
||||
GITHUB_EVENT_NAME: 'workflow_dispatch'
|
||||
GITHUB_EVENT_PATH: '/dev/null'
|
||||
with:
|
||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||
|
||||
# Explicitly provide GitHub token
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# Override prompt to skip PR detection and review the diff
|
||||
override_prompt: |
|
||||
You are performing a code review for PR #${{ env.PR_NUMBER }} from a fork.
|
||||
# Use the main prompt to guide Claude
|
||||
prompt: |
|
||||
You have a code review task in the review-context directory.
|
||||
|
||||
First, read the pr-diff.patch file that contains all the changes.
|
||||
Then provide a detailed code review following the format below.
|
||||
Finally, post your review as a comment on issue #${{ env.PR_NUMBER }}.
|
||||
Read the REVIEW_INSTRUCTIONS.md file for your task details.
|
||||
Then read and analyze the changes.patch file.
|
||||
|
||||
DO NOT attempt to checkout any code or fetch from git.
|
||||
The diff file has everything you need.
|
||||
Provide a detailed code review and post it as a comment on PR #${{ env.PR_NUMBER }}.
|
||||
|
||||
# Custom instructions for fork review
|
||||
custom_instructions: |
|
||||
|
||||
Reference in New Issue
Block a user