@@ -27,17 +27,16 @@ jobs:
2727 - name : Checkout repository
2828 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2929 with :
30- fetch-depth : 0
3130 persist-credentials : false
3231
32+ - name : Setup pnpm
33+ uses : pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
34+
3335 - name : Setup Node.js
3436 uses : actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
3537 with :
3638 node-version-file : .node-version
37- cache : ' '
38-
39- - name : Setup pnpm
40- uses : pnpm/action-setup@58e6119fe4f3092a76a7771efb55e04d25b6b26f # v5
39+ cache : ' pnpm'
4140
4241 - name : Install dependencies
4342 run : pnpm install --frozen-lockfile
@@ -69,14 +68,14 @@ jobs:
6968 fetch-depth : 0
7069 persist-credentials : false
7170
71+ - name : Setup pnpm
72+ uses : pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
73+
7274 - name : Setup Node.js
7375 uses : actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
7476 with :
7577 node-version-file : .node-version
76- cache : ' '
77-
78- - name : Setup pnpm
79- uses : pnpm/action-setup@58e6119fe4f3092a76a7771efb55e04d25b6b26f # v5
78+ cache : ' pnpm'
8079
8180 - name : Install dependencies
8281 run : pnpm install --frozen-lockfile
@@ -86,10 +85,13 @@ jobs:
8685
8786 - name : Create update branch
8887 id : branch
88+ env :
89+ GH_TOKEN : ${{ github.token }}
8990 run : |
9091 BRANCH_NAME="weekly-update-$(date +%Y%m%d)"
9192 git config user.name "github-actions[bot]"
9293 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"
9395 git checkout -b "$BRANCH_NAME"
9496 echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
9597
@@ -102,7 +104,7 @@ jobs:
102104 GITHUB_ACTIONS : ' true'
103105 run : |
104106 if [ -z "$ANTHROPIC_API_KEY" ]; then
105- echo "⚠️ ANTHROPIC_API_KEY not set - skipping automated update"
107+ echo "ANTHROPIC_API_KEY not set - skipping automated update"
106108 echo "success=false" >> $GITHUB_OUTPUT
107109 exit 0
108110 fi
@@ -133,11 +135,8 @@ jobs:
133135 - name : Push branch
134136 if : steps.claude.outputs.success == 'true' && steps.changes.outputs.has-changes == 'true'
135137 env :
136- GH_TOKEN : ${{ github.token }}
137138 BRANCH_NAME : ${{ steps.branch.outputs.branch }}
138- run : |
139- git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
140- git push origin "$BRANCH_NAME"
139+ run : git push origin "$BRANCH_NAME"
141140
142141 - name : Create Pull Request
143142 if : steps.claude.outputs.success == 'true' && steps.changes.outputs.has-changes == 'true'
@@ -147,35 +146,66 @@ jobs:
147146 run : |
148147 COMMITS=$(git log --oneline origin/main..HEAD)
149148 COMMIT_COUNT=$(git rev-list --count origin/main..HEAD)
150- PR_BODY="## Weekly Dependency Update
151-
152- Automated weekly update of npm packages.
153-
154- ### Commits (${COMMIT_COUNT})
155-
156- <details>
157- <summary>View commit history</summary>
158149
159- \`\`\`
160- ${COMMITS}
161- \`\`\`
150+ PR_BODY="## Weekly Dependency Update"$'\n\n'
151+ PR_BODY+="Automated weekly update of npm packages."$'\n\n'
152+ PR_BODY+="---"$'\n\n'
153+ PR_BODY+="### Commits (${COMMIT_COUNT})"$'\n\n'
154+ PR_BODY+="<details>"$'\n'
155+ PR_BODY+="<summary>View commit history</summary>"$'\n\n'
156+ PR_BODY+="\`\`\`"$'\n'
157+ PR_BODY+="${COMMITS}"$'\n'
158+ PR_BODY+="\`\`\`"$'\n\n'
159+ PR_BODY+="</details>"$'\n\n'
160+ PR_BODY+="---"$'\n\n'
161+ PR_BODY+="<sub>Generated by [weekly-update.yml](.github/workflows/weekly-update.yml)</sub>"
162162
163- </details>
164-
165- ---
166-
167- <sub>Generated by [weekly-update.yml](.github/workflows/weekly-update.yml)</sub>"
168163 gh pr create \
169164 --title "chore(deps): weekly dependency update ($(date +%Y-%m-%d))" \
170165 --body "$PR_BODY" \
171166 --draft \
172167 --head "$BRANCH_NAME" \
173168 --base main
174169
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+
175181 - name : Upload Claude output
176182 if : always()
177183 uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
178184 with :
179185 name : claude-output-${{ github.run_id }}
180186 path : claude-output.log
181187 retention-days : 7
188+
189+ notify :
190+ name : Notify results
191+ needs : [check-updates, apply-updates]
192+ if : always()
193+ runs-on : ubuntu-latest
194+ permissions :
195+ contents : read
196+ steps :
197+ - name : Report status
198+ env :
199+ HAS_UPDATES : ${{ needs.check-updates.outputs.has-updates }}
200+ DRY_RUN : ${{ inputs.dry-run }}
201+ run : |
202+ if [ "$HAS_UPDATES" = "true" ]; then
203+ if [ "$DRY_RUN" = "true" ]; then
204+ echo "Updates available (dry-run mode - no PR created)"
205+ else
206+ echo "Weekly update workflow completed"
207+ echo "Check the PRs tab for the automated update PR"
208+ fi
209+ else
210+ echo "All dependencies are up to date - no action needed!"
211+ fi
0 commit comments