From c0ce4617fd7ccb9c2cd93b8beb47c3cb68cc19dd Mon Sep 17 00:00:00 2001 From: Allison Durham Date: Tue, 20 May 2025 12:57:31 -0700 Subject: [PATCH 1/2] lesss go --- .github/workflows/claude-comment-response.yml | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/claude-comment-response.yml b/.github/workflows/claude-comment-response.yml index 6358198..74240f6 100644 --- a/.github/workflows/claude-comment-response.yml +++ b/.github/workflows/claude-comment-response.yml @@ -25,19 +25,32 @@ jobs: - name: Checkout PR branch if needed if: github.event.issue.pull_request env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_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} + # Get PR info + PR_INFO=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ + "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER") - echo "Current branch: $(git branch --show-current)" + # Extract the PR branch ref and other details + PR_BRANCH=$(echo "$PR_INFO" | jq -r .head.ref) + PR_SHA=$(echo "$PR_INFO" | jq -r .head.sha) + PR_REPO=$(echo "$PR_INFO" | jq -r .head.repo.full_name) + + echo "PR branch is $PR_BRANCH from repo $PR_REPO with commit SHA $PR_SHA" + + # Fetch the PR as a local branch (works for forks too) + git fetch origin "pull/$PR_NUMBER/head:pr-$PR_NUMBER" + git checkout "pr-$PR_NUMBER" + + # Verify checkout + echo "Current branch details:" git status + git rev-parse HEAD - name: Claude Response uses: anthropics/claude-code-action@beta From c12c61eda8c11b5cdeb2820f8ed5475f3ba324cd Mon Sep 17 00:00:00 2001 From: Allison Durham Date: Tue, 20 May 2025 13:00:29 -0700 Subject: [PATCH 2/2] perms updates --- .github/workflows/claude-code-review.yml | 5 +++++ .github/workflows/claude-comment-response.yml | 2 ++ .github/workflows/claude-pr-creation.yml | 2 ++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 3a6b238..ea30cb0 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -11,6 +11,11 @@ jobs: contents: read pull-requests: write issues: write + discussions: write + id-token: write + statuses: write + workflow: write + actions: 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 74240f6..a390c45 100644 --- a/.github/workflows/claude-comment-response.yml +++ b/.github/workflows/claude-comment-response.yml @@ -15,6 +15,8 @@ jobs: discussions: write id-token: write statuses: write + workflow: write + actions: 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 9d301ef..d6f615b 100644 --- a/.github/workflows/claude-pr-creation.yml +++ b/.github/workflows/claude-pr-creation.yml @@ -20,6 +20,8 @@ jobs: discussions: write id-token: write statuses: write + workflow: write + actions: write steps: - name: Checkout code uses: actions/checkout@v4