Skip to content

Commit 5190918

Browse files
authored
Modify CLAUDE code review workflow for PR handling (#1354)
1 parent a43a486 commit 5190918

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

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

Lines changed: 19 additions & 6 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,23 @@ 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+
env:
74+
PR_HEAD_REF: ${{ steps.mode.outputs.pr_head_ref }}
75+
run: |
76+
set -euo pipefail
77+
git fetch origin "$PR_HEAD_REF"
6578
6679
- name: Resolve review state
6780
id: state
@@ -214,7 +227,7 @@ jobs:
214227
- Nearby unchanged lines in changed files may be used as supporting context only.
215228
- Do NOT raise findings about code outside changed files.
216229
- Do NOT provide general repo suggestions or unrelated improvement ideas.
217-
- Do NOT include positive confirmations like "No issues with X".
230+
- Do NOT include positive confirmations like "No issues with X"
218231
- If confidence is low, omit the finding.
219232
220233
Allowed workflow:

0 commit comments

Comments
 (0)