Skip to content

Commit d32a0c2

Browse files
committed
fix(ci): fix weekly-update workflow auth and inputs handling
- Remove persist-credentials: false from apply-updates checkout so git push works - Use github.event.inputs.dry-run instead of inputs.dry-run for schedule compatibility - Add shell: bash declarations to all run steps - Fix pipefail for claude exit code capture through tee
1 parent 95355ea commit d32a0c2

1 file changed

Lines changed: 22 additions & 17 deletions

File tree

.github/workflows/weekly-update.yml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ jobs:
4040
uses: pnpm/action-setup@b307475762933b98ed359c036b0e51f26b63b74b # v5.0.0
4141

4242
- name: Install dependencies
43+
shell: bash
4344
run: pnpm install --frozen-lockfile
4445

4546
- name: Check for npm updates
4647
id: check
48+
shell: bash
4749
run: |
4850
echo "Checking for npm package updates..."
4951
HAS_UPDATES=false
@@ -57,7 +59,7 @@ jobs:
5759
apply-updates:
5860
name: Apply updates with Claude Code
5961
needs: check-updates
60-
if: needs.check-updates.outputs.has-updates == 'true' && inputs.dry-run != true
62+
if: needs.check-updates.outputs.has-updates == 'true' && github.event.inputs.dry-run != 'true'
6163
runs-on: ubuntu-latest
6264
permissions:
6365
contents: write
@@ -67,7 +69,6 @@ jobs:
6769
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6870
with:
6971
fetch-depth: 0
70-
persist-credentials: false
7172

7273
- name: Setup Node.js
7374
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
@@ -79,13 +80,16 @@ jobs:
7980
uses: pnpm/action-setup@b307475762933b98ed359c036b0e51f26b63b74b # v5.0.0
8081

8182
- name: Install dependencies
83+
shell: bash
8284
run: pnpm install --frozen-lockfile
8385

8486
- name: Install Claude Code
87+
shell: bash
8588
run: npm install -g @anthropic-ai/claude-code
8689

8790
- name: Create update branch
8891
id: branch
92+
shell: bash
8993
run: |
9094
BRANCH_NAME="weekly-update-$(date +%Y%m%d)"
9195
git config user.name "github-actions[bot]"
@@ -96,6 +100,7 @@ jobs:
96100
- name: Run updating skill with Claude Code
97101
id: claude
98102
timeout-minutes: 30
103+
shell: bash
99104
env:
100105
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
101106
CI: 'true'
@@ -107,19 +112,17 @@ jobs:
107112
exit 0
108113
fi
109114
115+
set -o pipefail
110116
claude --print --dangerously-skip-permissions \
111117
--model sonnet \
112118
"/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." \
113119
2>&1 | tee claude-output.log
114120
115-
if [ $? -eq 0 ]; then
116-
echo "success=true" >> $GITHUB_OUTPUT
117-
else
118-
echo "success=false" >> $GITHUB_OUTPUT
119-
fi
121+
echo "success=true" >> $GITHUB_OUTPUT
120122
121123
- name: Check for changes
122124
id: changes
125+
shell: bash
123126
run: |
124127
if [ -n "$(git status --porcelain)" ] || [ "$(git rev-list --count HEAD ^origin/main)" -gt 0 ]; then
125128
echo "has-changes=true" >> $GITHUB_OUTPUT
@@ -129,12 +132,14 @@ jobs:
129132
130133
- name: Push branch
131134
if: steps.claude.outputs.success == 'true' && steps.changes.outputs.has-changes == 'true'
135+
shell: bash
132136
env:
133137
BRANCH_NAME: ${{ steps.branch.outputs.branch }}
134138
run: git push origin "$BRANCH_NAME"
135139

136140
- name: Create Pull Request
137141
if: steps.claude.outputs.success == 'true' && steps.changes.outputs.has-changes == 'true'
142+
shell: bash
138143
env:
139144
GH_TOKEN: ${{ github.token }}
140145
BRANCH_NAME: ${{ steps.branch.outputs.branch }}
@@ -146,22 +151,22 @@ jobs:
146151
--title "chore(deps): weekly dependency update ($(date +%Y-%m-%d))" \
147152
--body "## Weekly Dependency Update
148153
149-
Automated weekly update of npm packages.
154+
Automated weekly update of npm packages.
150155
151-
### Commits (${COMMIT_COUNT})
156+
### Commits (${COMMIT_COUNT})
152157
153-
<details>
154-
<summary>View commit history</summary>
158+
<details>
159+
<summary>View commit history</summary>
155160
156-
\`\`\`
157-
${COMMITS}
158-
\`\`\`
161+
\`\`\`
162+
${COMMITS}
163+
\`\`\`
159164
160-
</details>
165+
</details>
161166
162-
---
167+
---
163168
164-
<sub>Generated by [weekly-update.yml](.github/workflows/weekly-update.yml)</sub>" \
169+
<sub>Generated by [weekly-update.yml](.github/workflows/weekly-update.yml)</sub>" \
165170
--draft \
166171
--head "$BRANCH_NAME" \
167172
--base main

0 commit comments

Comments
 (0)