Skip to content

Commit d20e096

Browse files
committed
fix(ci): fix invalid YAML syntax in weekly-update workflow
The inline multi-line PR body string caused YAML parsing failures because `### Commits` was interpreted as a YAML mapping key. Moved to a heredoc. Also fixed: removed persist-credentials: false from apply-updates job (was blocking git push), corrected inputs.dry-run to use github.event.inputs context, and added set -o pipefail so claude failures are properly captured through the tee pipe.
1 parent 14e57fe commit d20e096

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

.github/workflows/weekly-update.yml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
- name: Checkout repository
2828
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2929
with:
30-
fetch-depth: 0
3130
persist-credentials: false
3231

3332
- name: Setup Node.js
@@ -57,7 +56,7 @@ jobs:
5756
apply-updates:
5857
name: Apply updates with Claude Code
5958
needs: check-updates
60-
if: needs.check-updates.outputs.has-updates == 'true' && inputs.dry-run != true
59+
if: needs.check-updates.outputs.has-updates == 'true' && github.event.inputs.dry-run != 'true'
6160
runs-on: ubuntu-latest
6261
permissions:
6362
contents: write
@@ -67,7 +66,6 @@ jobs:
6766
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6867
with:
6968
fetch-depth: 0
70-
persist-credentials: false
7169

7270
- name: Setup Node.js
7371
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
@@ -101,18 +99,17 @@ jobs:
10199
CI: 'true'
102100
GITHUB_ACTIONS: 'true'
103101
run: |
102+
set -o pipefail
104103
if [ -z "$ANTHROPIC_API_KEY" ]; then
105104
echo "⚠️ ANTHROPIC_API_KEY not set - skipping automated update"
106105
echo "success=false" >> $GITHUB_OUTPUT
107106
exit 0
108107
fi
109108
110-
claude --print --dangerously-skip-permissions \
109+
if claude --print --dangerously-skip-permissions \
111110
--model sonnet \
112111
"/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." \
113-
2>&1 | tee claude-output.log
114-
115-
if [ $? -eq 0 ]; then
112+
2>&1 | tee claude-output.log; then
116113
echo "success=true" >> $GITHUB_OUTPUT
117114
else
118115
echo "success=false" >> $GITHUB_OUTPUT
@@ -142,26 +139,33 @@ jobs:
142139
COMMITS=$(git log --oneline origin/main..HEAD)
143140
COMMIT_COUNT=$(git rev-list --count origin/main..HEAD)
144141
145-
gh pr create \
146-
--title "chore(deps): weekly dependency update ($(date +%Y-%m-%d))" \
147-
--body "## Weekly Dependency Update
142+
BODY=$(cat <<EOF
143+
## Weekly Dependency Update
144+
145+
Automated weekly update of npm packages.
148146
149-
Automated weekly update of npm packages.
147+
### Commits (${COMMIT_COUNT})
150148
151-
### Commits (${COMMIT_COUNT})
149+
<details>
150+
<summary>View commit history</summary>
152151
153-
<details>
154-
<summary>View commit history</summary>
152+
\`\`\`
153+
${COMMITS}
154+
\`\`\`
155155
156-
\`\`\`
157-
${COMMITS}
158-
\`\`\`
156+
</details>
159157
160-
</details>
158+
---
161159
162-
---
160+
<sub>Generated by [weekly-update.yml](.github/workflows/weekly-update.yml)</sub>
161+
EOF
162+
)
163+
# Strip leading whitespace from heredoc lines
164+
BODY=$(echo "$BODY" | sed 's/^ //')
163165
164-
<sub>Generated by [weekly-update.yml](.github/workflows/weekly-update.yml)</sub>" \
166+
gh pr create \
167+
--title "chore(deps): weekly dependency update ($(date +%Y-%m-%d))" \
168+
--body "$BODY" \
165169
--draft \
166170
--head "$BRANCH_NAME" \
167171
--base main

0 commit comments

Comments
 (0)