@@ -136,20 +136,25 @@ jobs:
136136 if : steps.check-attempts.outputs.skip != 'true' && steps.failures.outputs.skip != 'true'
137137 run : npm install -g @anthropic-ai/claude-code
138138
139- - name : " Build prompt "
139+ - name : " Run Claude Code "
140140 if : steps.check-attempts.outputs.skip != 'true' && steps.failures.outputs.skip != 'true'
141+ env :
142+ CLAUDE_CODE_OAUTH_TOKEN : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
143+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
141144 run : |
142- {
143- cat << 'PROMPT_PART1'
145+ git config user.name "phpstan-bot"
146+ git config user.email "ondrej+phpstanbot@mirtes.cz"
147+
148+ claude -p \
149+ --model claude-opus-4-6 \
150+ "$(cat << 'PROMPT_EOF'
144151 You are working on phpstan/phpstan-src. CI has failed on PR #${{ github.event.pull_request.number }} which was created by an automated process.
145152
146153 This is CI fix attempt ${{ steps.check-attempts.outputs.attempt_number }} of maximum 2.
147154
148155 ## CI Failure Logs
149156
150- PROMPT_PART1
151- cat /tmp/ci-failure-context.txt
152- cat << 'PROMPT_PART2'
157+ Read the CI failure logs from the file /tmp/ci-failure-context.txt.
153158
154159 ## Your Task
155160
@@ -181,21 +186,8 @@ jobs:
181186 - Do NOT create a branch, push, or create a PR — this is handled automatically after you finish
182187 - Focus only on fixing the CI failures, do not refactor or add unrelated changes
183188 - If you cannot determine how to fix the failure, create a file /tmp/ci-fix-failed.txt with an explanation
184- PROMPT_PART2
185- } > /tmp/claude-ci-prompt.txt
186-
187- - name : " Run Claude Code"
188- if : steps.check-attempts.outputs.skip != 'true' && steps.failures.outputs.skip != 'true'
189- env :
190- CLAUDE_CODE_OAUTH_TOKEN : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
191- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
192- run : |
193- git config user.name "phpstan-bot"
194- git config user.email "ondrej+phpstanbot@mirtes.cz"
195-
196- claude -p \
197- --model claude-opus-4-6 \
198- "$(cat /tmp/claude-ci-prompt.txt)"
189+ PROMPT_EOF
190+ )"
199191
200192 - name : " Commit and push fixes"
201193 if : steps.check-attempts.outputs.skip != 'true' && steps.failures.outputs.skip != 'true'
0 commit comments