Skip to content

Commit c6b9fe5

Browse files
Copilotastandrik
andauthored
fix: code review workflows to checkout PR head commit (#2652)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: astandrik <8037318+astandrik@users.noreply.github.com>
1 parent 7be9d5f commit c6b9fe5

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ This is a React-based monitoring and management interface for YDB clusters. The
9898

9999
- Run `npm run lint` and `npm run typecheck` before committing
100100
- Follow conventional commit message format
101+
- Use conventional commit format for PR titles with lowercase subjects (e.g., "fix: update api endpoints", "feat: add new component", "chore: update dependencies")
102+
- PR title subjects must be lowercase (no proper nouns, sentence-case, start-case, pascal-case, or upper-case)
101103
- Ensure all user-facing text is internationalized
102104
- Test with a local YDB instance when possible
103105

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
claude-review:
1010
if: |
1111
github.event_name == 'workflow_dispatch' ||
12-
(github.event_name == 'issue_comment' &&
13-
github.event.issue.pull_request &&
12+
(github.event_name == 'issue_comment' &&
13+
github.event.issue.pull_request &&
1414
contains(github.event.comment.body, '/claude_review'))
1515
1616
runs-on: ubuntu-latest
@@ -21,10 +21,26 @@ jobs:
2121
id-token: write
2222

2323
steps:
24+
- name: Get PR details
25+
id: pr-details
26+
if: github.event_name == 'issue_comment'
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
run: |
30+
PR_NUMBER="${{ github.event.issue.number }}"
31+
PR_DATA=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
32+
"https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}")
33+
PR_HEAD_SHA=$(echo "$PR_DATA" | jq -r '.head.sha')
34+
echo "pr_head_sha=$PR_HEAD_SHA" >> $GITHUB_OUTPUT
35+
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
36+
2437
- name: Checkout repository
2538
uses: actions/checkout@v4
2639
with:
27-
fetch-depth: 1
40+
# For workflow_dispatch, checkout default branch
41+
# For issue_comment on PR, checkout the PR head commit
42+
ref: ${{ github.event_name == 'issue_comment' && steps.pr-details.outputs.pr_head_sha || github.ref }}
43+
fetch-depth: 0
2844

2945
- name: Run Claude Code Review
3046
id: claude-review

.github/workflows/claude.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
claude:
1010
if: |
1111
github.event_name == 'workflow_dispatch' ||
12-
(github.event_name == 'issue_comment' &&
13-
github.event.issue.pull_request &&
12+
(github.event_name == 'issue_comment' &&
13+
github.event.issue.pull_request &&
1414
contains(github.event.comment.body, '@claude'))
1515
runs-on: ubuntu-latest
1616
permissions:
@@ -20,10 +20,26 @@ jobs:
2020
id-token: write
2121
actions: read # Required for Claude to read CI results on PRs
2222
steps:
23+
- name: Get PR details
24+
id: pr-details
25+
if: github.event_name == 'issue_comment'
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
PR_NUMBER="${{ github.event.issue.number }}"
30+
PR_DATA=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
31+
"https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}")
32+
PR_HEAD_SHA=$(echo "$PR_DATA" | jq -r '.head.sha')
33+
echo "pr_head_sha=$PR_HEAD_SHA" >> $GITHUB_OUTPUT
34+
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
35+
2336
- name: Checkout repository
2437
uses: actions/checkout@v4
2538
with:
26-
fetch-depth: 1
39+
# For workflow_dispatch, checkout default branch
40+
# For issue_comment on PR, checkout the PR head commit
41+
ref: ${{ github.event_name == 'issue_comment' && steps.pr-details.outputs.pr_head_sha || github.ref }}
42+
fetch-depth: 0
2743

2844
- name: Run Claude Code
2945
id: claude

0 commit comments

Comments
 (0)