Skip to content

Commit 8f16b00

Browse files
authored
Modify CLAUDE code review workflow for PR handling
Updated the workflow to fetch the PR branch and adjusted checkout depth.
1 parent cf81f25 commit 8f16b00

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

.github/workflows/claude-code-review.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,11 @@ jobs:
4141
sudo apt-get update
4242
sudo apt-get install -y unzip jq
4343
44-
- name: Checkout base repo
45-
uses: actions/checkout@v4
46-
with:
47-
fetch-depth: 1
48-
4944
- name: Determine PR number
5045
id: mode
5146
shell: bash
47+
env:
48+
GH_TOKEN: ${{ github.token }}
5249
run: |
5350
set -euo pipefail
5451
@@ -61,7 +58,21 @@ jobs:
6158
exit 1
6259
fi
6360
61+
PR_HEAD_REF="$(gh pr view "$PR_NUMBER" --repo "${{ github.repository }}" --json headRefName --jq .headRefName)"
62+
6463
echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
64+
echo "pr_head_ref=$PR_HEAD_REF" >> "$GITHUB_OUTPUT"
65+
66+
- name: Checkout base repo
67+
uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0
70+
71+
- name: Fetch PR branch
72+
shell: bash
73+
run: |
74+
set -euo pipefail
75+
git fetch origin "${{ steps.mode.outputs.pr_head_ref }}"
6576
6677
- name: Resolve review state
6778
id: state

0 commit comments

Comments
 (0)