-
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (101 loc) · 4.31 KB
/
Copy pathclaude.yml
File metadata and controls
110 lines (101 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Claude
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]
issues:
types: [opened, assigned]
workflow_dispatch:
inputs:
branch:
description: "Branch Claude should operate on (used by autoupdate flow)"
required: true
type: string
pr_url:
description: "PR URL where Claude should post a status comment"
required: false
type: string
run_url:
description: "URL of the failing autoupdate run, included in the prompt for context"
required: false
type: string
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.issue.number || github.event.pull_request.number || github.event.inputs.branch }}"
cancel-in-progress: false
jobs:
claude:
name: Run Claude
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- name: Checkout repo
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.branch || github.ref }}
fetch-depth: 1
- name: Prepare autoupdate-fix prompt
if: github.event_name == 'workflow_dispatch'
id: prep
env:
BRANCH: ${{ github.event.inputs.branch }}
PR_URL: ${{ github.event.inputs.pr_url }}
RUN_URL: ${{ github.event.inputs.run_url }}
run: |
{
echo 'prompt<<PROMPT_EOF'
cat <<EOF
The dependency autoupdater failed on branch \`$BRANCH\` (run: $RUN_URL).
PR: $PR_URL
Run these commands and observe their exit codes via the Bash tool —
not inferred:
npm run build
npm test
Hard rules:
- Run those commands yourself before every push. Do not push
if any of them is red.
- If \`npm install\` or \`npm ci\` is needed, run it first with
\`--no-audit --no-fund\` and confirm exit 0.
- Limit edits to compatibility shims (types, renamed exports,
breaking-change adjustments, eslint-config tweaks for new rule
defaults). Do NOT change product logic.
- Do NOT bump the package version.
- When all commands are green, push commits with your fixes
(if any). \`pr-checks\` will re-run automatically on each push.
## MANDATORY final step
When you are done — whether you pushed fixes or determined no
changes were needed — you MUST post a status comment on the PR.
Run the following with the Bash tool:
gh pr comment "$PR_URL" --body "<your status summary>"
The comment must state plainly:
- Which command(s) failed initially (or "all green on first run").
- What changes you made (or "no fix needed").
- Whether you pushed any commits, and the SHA(s) if so.
Do NOT exit without posting this comment. The maintainer relies
on it to know what happened without reading the action log.
See CLAUDE.md in the repo root for the full project conventions.
EOF
echo PROMPT_EOF
} >> "$GITHUB_OUTPUT"
- name: Run Claude Code
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
allowed_bots: "*"
prompt: ${{ steps.prep.outputs.prompt }}
claude_args: |
--allowedTools "Edit,Write,MultiEdit,Bash(git:*),Bash(gh:*),Bash(npm:*),Bash(npx:*),Bash(node:*),Bash(rm:*),Bash(mkdir:*),Bash(cat:*),Bash(ls:*),Bash(echo:*),Bash(grep:*),Bash(find:*),Bash(sed:*),Bash(awk:*),Bash(head:*),Bash(tail:*),Bash(diff:*),Bash(mv:*),Bash(cp:*),Bash(touch:*)"