Skip to content

Commit b9f8de0

Browse files
committed
fix(ci): rebuild weekly-update.yml with proper YAML and features
Add notify job, job summary, set +e/PIPESTATUS exit code capture, persist-credentials: false with git remote set-url for push auth, PR body via variable construction.
1 parent 5817a14 commit b9f8de0

File tree

2 files changed

+33
-47
lines changed

2 files changed

+33
-47
lines changed

.github/workflows/weekly-update.yml

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,20 @@ jobs:
2323
contents: read
2424
outputs:
2525
has-updates: ${{ steps.check.outputs.has-updates }}
26-
update-summary: ${{ steps.check.outputs.update-summary }}
2726
steps:
2827
- name: Checkout repository
2928
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3029
with:
31-
fetch-depth: 0
3230
persist-credentials: false
3331

32+
- name: Setup pnpm
33+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
34+
3435
- name: Setup Node.js
3536
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
3637
with:
3738
node-version-file: .node-version
38-
cache: ''
39-
40-
- name: Setup pnpm
41-
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
39+
cache: 'pnpm'
4240

4341
- name: Install dependencies
4442
run: pnpm install --frozen-lockfile
@@ -47,31 +45,13 @@ jobs:
4745
id: check
4846
run: |
4947
echo "Checking for npm package updates..."
50-
5148
HAS_UPDATES=false
52-
SUMMARY=""
53-
54-
# Check for npm updates
5549
NPM_UPDATES=$(pnpm outdated 2>/dev/null || true)
5650
if [ -n "$NPM_UPDATES" ] && ! echo "$NPM_UPDATES" | grep -q "No outdated"; then
5751
echo "npm packages have updates available"
5852
HAS_UPDATES=true
59-
SUMMARY="npm packages: updates available"
6053
fi
61-
6254
echo "has-updates=$HAS_UPDATES" >> $GITHUB_OUTPUT
63-
if [ -n "$SUMMARY" ]; then
64-
SUMMARY_B64=$(echo "$SUMMARY" | base64 | tr -d '\n')
65-
echo "update-summary=$SUMMARY_B64" >> $GITHUB_OUTPUT
66-
fi
67-
68-
if [ "$HAS_UPDATES" = "true" ]; then
69-
echo ""
70-
echo "✓ Updates available!"
71-
else
72-
echo ""
73-
echo "✓ All dependencies are up to date"
74-
fi
7555
7656
apply-updates:
7757
name: Apply updates with Claude Code
@@ -88,14 +68,14 @@ jobs:
8868
fetch-depth: 0
8969
persist-credentials: false
9070

71+
- name: Setup pnpm
72+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
73+
9174
- name: Setup Node.js
9275
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
9376
with:
9477
node-version-file: .node-version
95-
cache: ''
96-
97-
- name: Setup pnpm
98-
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
78+
cache: 'pnpm'
9979

10080
- name: Install dependencies
10181
run: pnpm install --frozen-lockfile
@@ -105,10 +85,13 @@ jobs:
10585

10686
- name: Create update branch
10787
id: branch
88+
env:
89+
GH_TOKEN: ${{ github.token }}
10890
run: |
10991
BRANCH_NAME="weekly-update-$(date +%Y%m%d)"
11092
git config user.name "github-actions[bot]"
11193
git config user.email "github-actions[bot]@users.noreply.github.com"
94+
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
11295
git checkout -b "$BRANCH_NAME"
11396
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
11497
@@ -121,42 +104,39 @@ jobs:
121104
GITHUB_ACTIONS: 'true'
122105
run: |
123106
if [ -z "$ANTHROPIC_API_KEY" ]; then
124-
echo "⚠️ ANTHROPIC_API_KEY not set - skipping automated update"
125-
echo "Please add ANTHROPIC_API_KEY to repository secrets to enable automation"
107+
echo "ANTHROPIC_API_KEY not set - skipping automated update"
126108
echo "success=false" >> $GITHUB_OUTPUT
127109
exit 0
128110
fi
129111
112+
set +e
130113
claude --print --dangerously-skip-permissions \
131114
--model sonnet \
132-
"/updating - Run the updating skill to update all dependencies. Create atomic commits for each update. You are running in CI mode - skip builds and tests (CI will run them separately). Do not push or create a PR - just make the changes and commits locally." \
115+
"/updating - Run the updating skill to update all dependencies. Create atomic commits for each update. You are running in CI mode - skip builds and tests. Do not push or create a PR." \
133116
2>&1 | tee claude-output.log
117+
CLAUDE_EXIT=${PIPESTATUS[0]}
118+
set -e
134119
135-
if [ $? -eq 0 ]; then
120+
if [ "$CLAUDE_EXIT" -eq 0 ]; then
136121
echo "success=true" >> $GITHUB_OUTPUT
137-
echo "✓ Claude Code successfully applied updates"
138122
else
139123
echo "success=false" >> $GITHUB_OUTPUT
140-
echo "⚠️ Claude Code encountered errors"
141124
fi
142125
143126
- name: Check for changes
144127
id: changes
145128
run: |
146129
if [ -n "$(git status --porcelain)" ] || [ "$(git rev-list --count HEAD ^origin/main)" -gt 0 ]; then
147130
echo "has-changes=true" >> $GITHUB_OUTPUT
148-
echo "✓ Changes detected"
149131
else
150132
echo "has-changes=false" >> $GITHUB_OUTPUT
151-
echo "No changes to commit"
152133
fi
153134
154135
- name: Push branch
155136
if: steps.claude.outputs.success == 'true' && steps.changes.outputs.has-changes == 'true'
156137
env:
157138
BRANCH_NAME: ${{ steps.branch.outputs.branch }}
158-
run: |
159-
git push origin "$BRANCH_NAME"
139+
run: git push origin "$BRANCH_NAME"
160140

161141
- name: Create Pull Request
162142
if: steps.claude.outputs.success == 'true' && steps.changes.outputs.has-changes == 'true'
@@ -178,11 +158,6 @@ jobs:
178158
PR_BODY+="\`\`\`"$'\n\n'
179159
PR_BODY+="</details>"$'\n\n'
180160
PR_BODY+="---"$'\n\n'
181-
PR_BODY+="### Review Checklist"$'\n\n'
182-
PR_BODY+="- [ ] All builds pass"$'\n'
183-
PR_BODY+="- [ ] Tests pass"$'\n'
184-
PR_BODY+="- [ ] No breaking changes"$'\n\n'
185-
PR_BODY+="---"$'\n\n'
186161
PR_BODY+="<sub>Generated by [weekly-update.yml](.github/workflows/weekly-update.yml)</sub>"
187162
188163
gh pr create \
@@ -192,6 +167,17 @@ jobs:
192167
--head "$BRANCH_NAME" \
193168
--base main
194169
170+
- name: Add job summary
171+
if: steps.claude.outputs.success == 'true' && steps.changes.outputs.has-changes == 'true'
172+
env:
173+
BRANCH_NAME: ${{ steps.branch.outputs.branch }}
174+
run: |
175+
COMMIT_COUNT=$(git rev-list --count origin/main..HEAD)
176+
echo "## Weekly Update Complete" >> $GITHUB_STEP_SUMMARY
177+
echo "" >> $GITHUB_STEP_SUMMARY
178+
echo "**Branch:** \`${BRANCH_NAME}\`" >> $GITHUB_STEP_SUMMARY
179+
echo "**Commits:** ${COMMIT_COUNT}" >> $GITHUB_STEP_SUMMARY
180+
195181
- name: Upload Claude output
196182
if: always()
197183
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
@@ -215,11 +201,11 @@ jobs:
215201
run: |
216202
if [ "$HAS_UPDATES" = "true" ]; then
217203
if [ "$DRY_RUN" = "true" ]; then
218-
echo "Updates available (dry-run mode - no PR created)"
204+
echo "Updates available (dry-run mode - no PR created)"
219205
else
220-
echo "Weekly update workflow completed"
206+
echo "Weekly update workflow completed"
221207
echo "Check the PRs tab for the automated update PR"
222208
fi
223209
else
224-
echo "All dependencies are up to date - no action needed!"
210+
echo "All dependencies are up to date - no action needed!"
225211
fi

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
25.8.1
1+
25.8.2

0 commit comments

Comments
 (0)