Skip to content

Commit 31b577d

Browse files
claudeondrejmirtes
authored andcommitted
Update claude-easy-fixes workflow to use phpstan-bot and peter-evans PR action
- Use PHPSTAN_BOT_TOKEN for checkout and GH CLI (matching update-phpstorm-stubs.yml) - Configure git committer as phpstan-bot instead of github-actions[bot] - Replace Claude-driven PR creation with peter-evans/create-pull-request@v6 - Add explicit setup-node step with npm cache - Remove --max-turns CLI option https://claude.ai/code/session_016XMNzioWzzD3m3CoHrYNTD
1 parent d3ee397 commit 31b577d

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

.github/workflows/claude-easy-fixes.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
with:
2121
ref: "2.1.x"
2222
fetch-depth: 0
23+
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
2324

2425
- name: "Install PHP"
2526
uses: "shivammathur/setup-php@v2"
@@ -34,7 +35,7 @@ jobs:
3435
- name: "Pick a random Easy fix issue"
3536
id: pick-issue
3637
env:
37-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
GH_TOKEN: ${{ secrets.PHPSTAN_BOT_TOKEN }}
3839
run: |
3940
ISSUE_JSON=$(gh issue list \
4041
--repo phpstan/phpstan \
@@ -73,6 +74,12 @@ jobs:
7374
echo "### Selected issue: #$ISSUE_NUMBER - $ISSUE_TITLE" >> "$GITHUB_STEP_SUMMARY"
7475
echo "$ISSUE_URL" >> "$GITHUB_STEP_SUMMARY"
7576
77+
- name: "Setup Node.js"
78+
uses: actions/setup-node@v4
79+
with:
80+
node-version: "20"
81+
cache: "npm"
82+
7683
- name: "Install Claude Code"
7784
run: npm install -g @anthropic-ai/claude-code
7885

@@ -148,15 +155,7 @@ jobs:
148155
3. Run PHPStan self-analysis: make phpstan
149156
4. Fix any failures that come up
150157
151-
## Step 5: Create a branch and PR
152-
153-
1. Create a branch named fix/bug-{n}
154-
2. Commit all changes with message: "Fix #{n}"
155-
3. Push the branch
156-
4. Create a PR targeting the 2.1.x branch with:
157-
- Title: "Fix #{n}: {title}"
158-
- Body referencing the issue: "Fixes phpstan/phpstan#{n}"
159-
- Include a description of the fix and what was wrong
158+
Do not create a branch, push, or create a PR - this will be handled automatically.
160159
"""
161160
162161
with open("/tmp/claude-prompt.txt", "w") as f:
@@ -166,12 +165,23 @@ jobs:
166165
- name: "Run Claude Code"
167166
env:
168167
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
169-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168+
GH_TOKEN: ${{ secrets.PHPSTAN_BOT_TOKEN }}
170169
run: |
171-
git config user.name "github-actions[bot]"
172-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
170+
git config user.name "phpstan-bot"
171+
git config user.email "ondrej+phpstanbot@mirtes.cz"
173172
174173
claude -p \
175174
--model claude-opus-4-6 \
176-
--max-turns 50 \
177175
"$(cat /tmp/claude-prompt.txt)"
176+
177+
- name: "Create Pull Request"
178+
id: create-pr
179+
uses: peter-evans/create-pull-request@v6
180+
with:
181+
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
182+
branch-suffix: random
183+
delete-branch: true
184+
title: "Fix #${{ steps.pick-issue.outputs.issue_number }}: ${{ steps.pick-issue.outputs.issue_title }}"
185+
body: "Fixes phpstan/phpstan#${{ steps.pick-issue.outputs.issue_number }}"
186+
committer: "phpstan-bot <ondrej+phpstanbot@mirtes.cz>"
187+
commit-message: "Fix #${{ steps.pick-issue.outputs.issue_number }}"

0 commit comments

Comments
 (0)