From 8e7d16fed94fed9d8353b17c4a5148da9c949367 Mon Sep 17 00:00:00 2001 From: Allison Durham Date: Tue, 20 May 2025 12:48:44 -0700 Subject: [PATCH 1/2] get code for PR if @claude is on PR --- .github/workflows/claude-comment-response.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/claude-comment-response.yml b/.github/workflows/claude-comment-response.yml index 5b600c8..8ca8ae3 100644 --- a/.github/workflows/claude-comment-response.yml +++ b/.github/workflows/claude-comment-response.yml @@ -18,6 +18,24 @@ jobs: with: fetch-depth: 0 # Fetch full history for accurate diffs + # If running on a PR comment, we need to explicitly check out the PR branch + - name: Checkout PR branch if needed + if: github.event.issue.pull_request + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Get the PR number from the issue object + PR_NUMBER="${{ github.event.issue.number }}" + + echo "Checking out PR #${PR_NUMBER}" + + # Use GitHub CLI to checkout the PR + # This handles both internal branches and forks automatically + gh pr checkout ${PR_NUMBER} + + echo "Current branch: $(git branch --show-current)" + git status + - name: Claude Response uses: anthropics/claude-code-action@beta with: @@ -49,7 +67,6 @@ jobs: GlobTool # Find files by pattern GrepTool # Search file contents BatchTool # Run multiple tools in parallel - # Timeout after 20 minutes timeout_minutes: 20 From f3b54e8db90bc3bd7eb14f92f2e4aaf4ca89d883 Mon Sep 17 00:00:00 2001 From: Allison Durham Date: Tue, 20 May 2025 12:50:56 -0700 Subject: [PATCH 2/2] permissions change attempt --- .github/workflows/claude-code-review.yml | 1 + .github/workflows/claude-comment-response.yml | 3 +++ .github/workflows/claude-pr-creation.yml | 3 +++ 3 files changed, 7 insertions(+) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index a8001e4..3a6b238 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -10,6 +10,7 @@ jobs: permissions: contents: read pull-requests: write + issues: write steps: # Check out the code to allow git diff operations - name: Checkout code diff --git a/.github/workflows/claude-comment-response.yml b/.github/workflows/claude-comment-response.yml index 8ca8ae3..6358198 100644 --- a/.github/workflows/claude-comment-response.yml +++ b/.github/workflows/claude-comment-response.yml @@ -12,6 +12,9 @@ jobs: contents: write pull-requests: write issues: write + discussions: write + id-token: write + statuses: write steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/claude-pr-creation.yml b/.github/workflows/claude-pr-creation.yml index f1bd086..9d301ef 100644 --- a/.github/workflows/claude-pr-creation.yml +++ b/.github/workflows/claude-pr-creation.yml @@ -17,6 +17,9 @@ jobs: contents: write pull-requests: write issues: write + discussions: write + id-token: write + statuses: write steps: - name: Checkout code uses: actions/checkout@v4