Skip to content

Commit 01bcdff

Browse files
authored
Use reusable Claude Code workflow from test-infra (#3788)
## Summary Replaces the inline Claude Code workflow with the centralized reusable workflow from `pytorch/test-infra`. ### What changes - Drops the hardcoded pilot user allowlist (20 users) in favor of `author_association` checks + API-level write access verification - Removes `pull_request_review_comment` trigger (security fix, per pytorch/pytorch#176652) - Passes lintrunner install via `setup_script` input (preserving the existing setup) ### What stays the same - Same security model (org gate, write access check, bot allowlist) - Same lintrunner setup (`pip install lintrunner==0.12.5 && lintrunner init`) - Same model, settings, and usage metrics upload Depends on pytorch/test-infra#7810 which added the reusable workflow. ## Test plan - [x] Reusable workflow tested end-to-end on pytorch/ciforge - [ ] Verify `@claude` triggers correctly after merge
1 parent f380781 commit 01bcdff

1 file changed

Lines changed: 6 additions & 73 deletions

File tree

.github/workflows/claude-code.yml

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,19 @@ name: Claude Code
33
on:
44
issue_comment:
55
types: [created]
6-
pull_request_review_comment:
7-
types: [created]
86
issues:
97
types: [opened]
108

119
jobs:
1210
claude-code:
13-
# Early exit conditions:
14-
# 1. Must be pytorch org
15-
# 2. Must be triggered by pilot user
16-
# 3. Must mention @claude
17-
if: |
18-
github.repository_owner == 'pytorch' &&
19-
contains(fromJSON('[
20-
"huydhn",
21-
"seemethere",
22-
"malfet",
23-
"ZainRizvi",
24-
"jeanschmidt",
25-
"atalman",
26-
"wdvr",
27-
"izaitsevfb",
28-
"yangw-dev",
29-
"ezyang",
30-
"drisspg",
31-
"albanD",
32-
"eellison",
33-
"pytorch-auto-revert[bot]",
34-
"janeyx99",
35-
"SherlockNoMad",
36-
"svekars",
37-
"sekyondaMeta",
38-
"AlannaBurke",
39-
"ngimel"
40-
]'), github.actor) &&
41-
(
42-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
43-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
44-
(github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
45-
)
46-
runs-on: ubuntu-latest
47-
timeout-minutes: 60
48-
environment: bedrock
11+
uses: pytorch/test-infra/.github/workflows/_claude-code.yml@main
4912
permissions:
5013
contents: read
5114
pull-requests: write
5215
issues: write
5316
id-token: write
54-
steps:
55-
# Fork PR support enabled by using izaitsevfb/claude-code-action@forked-pr-fix
56-
57-
- uses: actions/checkout@v4
58-
with:
59-
fetch-depth: 1
60-
61-
- name: Set up Python
62-
uses: actions/setup-python@v5
63-
with:
64-
python-version: '3.12'
65-
66-
- name: Install lintrunner
67-
run: |
68-
pip install lintrunner==0.12.5
69-
lintrunner init
70-
71-
- name: Configure AWS credentials via OIDC
72-
uses: aws-actions/configure-aws-credentials@v4
73-
with:
74-
role-to-assume: arn:aws:iam::308535385114:role/gha_workflow_claude_code
75-
aws-region: us-east-1
76-
77-
- name: Run Claude Code
78-
uses: izaitsevfb/claude-code-action@forked-pr-fix
79-
with:
80-
# We filter by github.actor at workflow level, there is no point of filtering here as well
81-
allowed_bots: "*"
82-
claude_args: "--model global.anthropic.claude-opus-4-6-v1"
83-
settings: '{"alwaysThinkingEnabled": true}'
84-
use_bedrock: "true"
85-
86-
- name: Upload usage metrics
87-
if: always()
88-
uses: pytorch/test-infra/.github/actions/upload-claude-usage@main
17+
secrets: inherit
18+
with:
19+
setup_script: |
20+
pip install lintrunner==0.12.5
21+
lintrunner init

0 commit comments

Comments
 (0)