@@ -94,14 +94,13 @@ jobs:
9494 with :
9595 gpg-private-key : ${{ secrets.BOT_GPG_PRIVATE_KEY }}
9696
97- - name : Run updating skill with Claude Code
98- id : claude
99- timeout-minutes : 15
97+ - name : Update dependencies (haiku — fast, cheap)
98+ id : update
99+ timeout-minutes : 10
100100 env :
101101 ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
102102 GITHUB_ACTIONS : ' true'
103103 run : |
104- # Wrap pnpm through Socket firewall for all subprocesses (not just this shell).
105104 if [ -n "$SFW_BIN" ]; then
106105 mkdir -p /tmp/sfw-bin
107106 printf '#!/bin/bash\nexec "%s" pnpm "$@"\n' "$SFW_BIN" > /tmp/sfw-bin/pnpm
@@ -117,9 +116,9 @@ jobs:
117116
118117 set +e
119118 pnpm exec claude --print \
120- --allowedTools "Bash(pnpm:*)" "Bash(git:*)" "Read" "Write" "Edit" "Glob" "Grep" \
121- --model sonnet \
122- --max-turns 25 \
119+ --allowedTools "Bash(pnpm:*)" "Bash(git add:*)" "Bash(git commit:*)" "Bash(git status:*)" "Bash(git diff:*)" "Bash(git log:*)" "Bash(git rev-parse :*)" "Read" "Write" "Edit" "Glob" "Grep" \
120+ --model haiku \
121+ --max-turns 15 \
123122 "$(cat <<'PROMPT'
124123 /updating
125124
@@ -132,7 +131,7 @@ jobs:
132131 Update all dependencies to their latest versions.
133132 Create one atomic commit per dependency update with a conventional commit message.
134133 Leave all changes local — the workflow handles pushing and PR creation.
135- Skip running builds, tests, and type checks — CI runs those separately .
134+ Do not run builds or tests — the next step handles that .
136135 </instructions>
137136
138137 <success_criteria>
@@ -142,7 +141,7 @@ jobs:
142141 </success_criteria>
143142 PROMPT
144143 )" \
145- 2>&1 | tee claude-output .log
144+ 2>&1 | tee claude-update .log
146145 CLAUDE_EXIT=${PIPESTATUS[0]}
147146 set -e
148147
@@ -152,15 +151,112 @@ jobs:
152151 echo "success=false" >> $GITHUB_OUTPUT
153152 fi
154153
154+ - name : Run tests
155+ id : tests
156+ if : steps.update.outputs.success == 'true'
157+ run : |
158+ if [ -n "$SFW_BIN" ]; then
159+ mkdir -p /tmp/sfw-bin
160+ printf '#!/bin/bash\nexec "%s" pnpm "$@"\n' "$SFW_BIN" > /tmp/sfw-bin/pnpm
161+ chmod +x /tmp/sfw-bin/pnpm
162+ export PATH="/tmp/sfw-bin:$PATH"
163+ fi
164+
165+ set +e
166+ pnpm build 2>&1 | tee build.log
167+ BUILD_EXIT=${PIPESTATUS[0]}
168+
169+ pnpm test 2>&1 | tee test.log
170+ TEST_EXIT=${PIPESTATUS[0]}
171+ set -e
172+
173+ if [ "$BUILD_EXIT" -eq 0 ] && [ "$TEST_EXIT" -eq 0 ]; then
174+ echo "tests-passed=true" >> $GITHUB_OUTPUT
175+ else
176+ echo "tests-passed=false" >> $GITHUB_OUTPUT
177+ fi
178+
179+ - name : Fix test failures (sonnet — smarter, escalated)
180+ id : claude
181+ if : steps.update.outputs.success == 'true' && steps.tests.outputs.tests-passed == 'false'
182+ timeout-minutes : 15
183+ env :
184+ ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
185+ GITHUB_ACTIONS : ' true'
186+ run : |
187+ if [ -n "$SFW_BIN" ]; then
188+ mkdir -p /tmp/sfw-bin
189+ printf '#!/bin/bash\nexec "%s" pnpm "$@"\n' "$SFW_BIN" > /tmp/sfw-bin/pnpm
190+ chmod +x /tmp/sfw-bin/pnpm
191+ export PATH="/tmp/sfw-bin:$PATH"
192+ fi
193+
194+ FAILURE_LOG="$(cat build.log test.log 2>/dev/null)"
195+
196+ set +e
197+ pnpm exec claude --print \
198+ --allowedTools "Bash(pnpm:*)" "Bash(git add:*)" "Bash(git commit:*)" "Bash(git status:*)" "Bash(git diff:*)" "Bash(git log:*)" "Bash(git rev-parse:*)" "Read" "Write" "Edit" "Glob" "Grep" \
199+ --model sonnet \
200+ --max-turns 25 \
201+ "$(cat <<PROMPT
202+ <context>
203+ You are an automated CI agent in a weekly dependency update workflow.
204+ Git is configured with GPG signing. A branch has been created for you.
205+ Dependencies were updated in the previous step but build/tests failed.
206+ </context>
207+
208+ <failure_log>
209+ $FAILURE_LOG
210+ </failure_log>
211+
212+ <instructions>
213+ The dependency updates above caused build or test failures.
214+ Diagnose the failures from the logs and fix the code so it builds and tests pass.
215+ Create one atomic commit per fix with a conventional commit message.
216+ Run pnpm build && pnpm test to verify your fixes.
217+ Leave all changes local — the workflow handles pushing and PR creation.
218+ </instructions>
219+
220+ <success_criteria>
221+ pnpm build succeeds.
222+ pnpm test succeeds.
223+ Each fix has its own commit.
224+ No uncommitted changes remain in the working tree.
225+ </success_criteria>
226+ PROMPT
227+ )" \
228+ 2>&1 | tee claude-fix.log
229+ CLAUDE_EXIT=${PIPESTATUS[0]}
230+ set -e
231+
232+ if [ "$CLAUDE_EXIT" -eq 0 ]; then
233+ echo "success=true" >> $GITHUB_OUTPUT
234+ else
235+ echo "success=false" >> $GITHUB_OUTPUT
236+ fi
237+
238+ - name : Set final status
239+ id : final
240+ if : always()
241+ run : |
242+ if [ "${{ steps.update.outputs.success }}" = "true" ] && [ "${{ steps.tests.outputs.tests-passed }}" = "true" ]; then
243+ echo "success=true" >> $GITHUB_OUTPUT
244+ elif [ "${{ steps.update.outputs.success }}" = "true" ] && [ "${{ steps.claude.outputs.success }}" = "true" ]; then
245+ echo "success=true" >> $GITHUB_OUTPUT
246+ else
247+ echo "success=false" >> $GITHUB_OUTPUT
248+ fi
249+
155250 - name : Validate changes
156251 id : validate
157- if : steps.claude .outputs.success == 'true'
252+ if : steps.final .outputs.success == 'true'
158253 run : |
159- # Only allow changes to dependency-related files.
160254 UNEXPECTED=""
161255 for file in $(git diff --name-only origin/main..HEAD); do
162256 case "$file" in
163257 package.json|*/package.json|pnpm-lock.yaml|*/pnpm-lock.yaml|.npmrc|pnpm-workspace.yaml) ;;
258+ src/*|test/*) ;;
259+ *.ts|*.mts|*.js|*.mjs) ;;
164260 *) UNEXPECTED="$UNEXPECTED $file" ;;
165261 esac
166262 done
@@ -181,13 +277,13 @@ jobs:
181277 fi
182278
183279 - name : Push branch
184- if : steps.claude .outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
280+ if : steps.final .outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
185281 env :
186282 BRANCH_NAME : ${{ steps.branch.outputs.branch }}
187283 run : git push origin "$BRANCH_NAME"
188284
189285 - name : Create Pull Request
190- if : steps.claude .outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
286+ if : steps.final .outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
191287 env :
192288 GH_TOKEN : ${{ github.token }}
193289 BRANCH_NAME : ${{ steps.branch.outputs.branch }}
@@ -216,7 +312,7 @@ jobs:
216312 --base main
217313
218314 - name : Add job summary
219- if : steps.claude .outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
315+ if : steps.final .outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
220316 env :
221317 BRANCH_NAME : ${{ steps.branch.outputs.branch }}
222318 run : |
@@ -231,7 +327,11 @@ jobs:
231327 uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
232328 with :
233329 name : claude-output-${{ github.run_id }}
234- path : claude-output.log
330+ path : |
331+ claude-update.log
332+ claude-fix.log
333+ build.log
334+ test.log
235335 retention-days : 7
236336
237337 - uses : SocketDev/socket-registry/.github/actions/cleanup-git-signing@6096b06b1790f411714c89c40f72aade2eeaab7c # main
0 commit comments