55 types : [opened, reopened, ready_for_review]
66 issue_comment :
77 types : [created]
8+ push :
9+ branches :
10+ - " pull-request/[0-9]+"
811
912permissions :
1013 contents : read
@@ -24,25 +27,63 @@ jobs:
2427 auto-review :
2528 name : Claude Review (auto)
2629 needs : [pre-flight]
27- # Auto-review non-draft PRs from NVIDIA authors on open / reopen / ready-for-review.
28- # Subsequent commits do not re-trigger; re-request a review by commenting
29- # "/claude review" (handled by the manual-review job below).
30+ # Review same-repository PRs when opened. For fork PRs, wait until
31+ # copy-pr-bot creates a trusted pull-request/<number> branch in this repo.
3032 # Skip bot-generated PRs: dependency bumps (`bump-ci-container-*`) and
3133 # auto cherry-picks (`cherry-pick-*`).
3234 if : |
33- github.event_name == 'pull_request' &&
3435 needs.pre-flight.outputs.is_member == 'true' &&
35- github.event.pull_request.draft == false &&
36- !startsWith(github.event.pull_request.head.ref, 'bump-ci-container-') &&
37- !startsWith(github.event.pull_request.head.ref, 'cherry-pick-')
36+ ((github.event_name == 'pull_request' &&
37+ github.event.pull_request.head.repo.full_name == github.repository &&
38+ github.event.pull_request.draft == false &&
39+ !startsWith(github.event.pull_request.head.ref, 'bump-ci-container-') &&
40+ !startsWith(github.event.pull_request.head.ref, 'cherry-pick-')) ||
41+ (github.event_name == 'push' &&
42+ startsWith(github.ref, 'refs/heads/pull-request/') &&
43+ github.event.created == true))
3844 runs-on : ubuntu-latest
3945 steps :
46+ - name : Get PR info
47+ id : get-pr-info
48+ if : github.event_name == 'push'
49+ uses : nv-gha-runners/get-pr-info@090577647b8ddc4e06e809e264f7881650ecdccf # main
50+
51+ - name : Resolve PR
52+ id : pr
53+ env :
54+ EVENT_NAME : ${{ github.event_name }}
55+ EVENT_PR_NUMBER : ${{ github.event.pull_request.number }}
56+ PR_INFO : ${{ steps.get-pr-info.outputs.pr-info }}
57+ REPOSITORY : ${{ github.repository }}
58+ run : |
59+ if [[ "$EVENT_NAME" == "push" ]]; then
60+ number=$(jq -r '.number // empty' <<< "$PR_INFO")
61+ head_repo=$(jq -r '.head.repo.full_name // empty' <<< "$PR_INFO")
62+ head_ref=$(jq -r '.head.ref // empty' <<< "$PR_INFO")
63+ draft=$(jq -r '.draft // true' <<< "$PR_INFO")
64+
65+ eligible=true
66+ if [[ -z "$number" || "$head_repo" == "$REPOSITORY" || "$draft" == "true" ]]; then
67+ eligible=false
68+ elif [[ "$head_ref" == bump-ci-container-* || "$head_ref" == cherry-pick-* ]]; then
69+ eligible=false
70+ fi
71+ else
72+ number=$EVENT_PR_NUMBER
73+ eligible=true
74+ fi
75+
76+ echo "eligible=$eligible" >> "$GITHUB_OUTPUT"
77+ echo "number=$number" >> "$GITHUB_OUTPUT"
78+
4079 - name : Checkout repository
80+ if : steps.pr.outputs.eligible == 'true'
4181 uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
4282 with :
4383 fetch-depth : 1
4484
4585 - name : Run Claude Code Review
86+ if : steps.pr.outputs.eligible == 'true'
4687 uses : anthropics/claude-code-action@be7b93b1907a4abad570368f3c74b6fe3807510b # v1
4788 env :
4889 ANTHROPIC_BASE_URL : ${{ secrets.NVIDIA_INFERENCE_URL }}
5596 --model "${{ vars.CLAUDE_MODEL }}"
5697 prompt : |
5798 REPO: ${{ github.repository }}
58- PR NUMBER: ${{ github.event.pull_request .number }}
99+ PR NUMBER: ${{ steps.pr.outputs .number }}
59100
60101 Mandatory workflow — never skip or reorder:
61102 1. Read the PR diff first (gh pr diff).
0 commit comments