Skip to content

Commit 84942ca

Browse files
committed
Use reusable Claude Code workflow from test-infra
Replace the inline workflow with the centralized reusable workflow. Passes lintrunner install via setup_script input.
1 parent f380781 commit 84942ca

1 file changed

Lines changed: 12 additions & 78 deletions

File tree

.github/workflows/claude-code.yml

Lines changed: 12 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,20 @@ 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

9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
issues: write
13+
id-token: write
14+
1115
jobs:
1216
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
49-
permissions:
50-
contents: read
51-
pull-requests: write
52-
issues: write
53-
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+
uses: pytorch/test-infra/.github/workflows/_claude-code.yml@main
18+
secrets: inherit
19+
with:
20+
setup_script: |
21+
pip install lintrunner==0.12.5
22+
lintrunner init

0 commit comments

Comments
 (0)