Skip to content

Commit 0b4be71

Browse files
committed
chore(workflow): tighten shell strictness and fix provenance debug type
- weekly-update.yml: add `set -euo pipefail` to every multi-line run block so failures in setup commands (git remote, git checkout, env guards) stop the step immediately instead of being masked by a later `set +e`. Quote `$GITHUB_OUTPUT` and `$GITHUB_STEP_SUMMARY` redirects to silence shellcheck SC2086, and group the BUILD_LOG/TEST_LOG heredocs into a single redirect (SC2129). - provenance.yml: the `debug` workflow_dispatch input declared `type: string` with an `options:` list, which actionlint flags as invalid. Switch to `type: choice` so options are honored and the dispatch UI renders a dropdown.
1 parent e3d5f6a commit 0b4be71

2 files changed

Lines changed: 35 additions & 24 deletions

File tree

.github/workflows/provenance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
description: 'Enable debug output'
1616
required: false
1717
default: '0'
18-
type: string
18+
type: choice
1919
options:
2020
- '0'
2121
- '1'

.github/workflows/weekly-update.yml

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ jobs:
3030
id: check
3131
shell: bash
3232
run: |
33+
set -euo pipefail
3334
echo "Checking for npm package updates..."
3435
HAS_UPDATES=false
3536
NPM_UPDATES=$(pnpm outdated 2>/dev/null || true)
3637
if [ -n "$NPM_UPDATES" ] && ! echo "$NPM_UPDATES" | grep -q "No outdated"; then
3738
echo "npm packages have updates available"
3839
HAS_UPDATES=true
3940
fi
40-
echo "has-updates=$HAS_UPDATES" >> $GITHUB_OUTPUT
41+
echo "has-updates=$HAS_UPDATES" >> "$GITHUB_OUTPUT"
4142
4243
apply-updates:
4344
name: Apply updates with Claude Code
@@ -55,10 +56,11 @@ jobs:
5556
env:
5657
GH_TOKEN: ${{ github.token }}
5758
run: |
59+
set -euo pipefail
5860
BRANCH_NAME="weekly-update-$(date +%Y%m%d)"
5961
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
6062
git checkout -b "$BRANCH_NAME"
61-
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
63+
echo "branch=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
6264
6365
- uses: SocketDev/socket-registry/.github/actions/setup-git-signing@34fef52be917f89dbbeb464860f2aaf0f3812c40 # main
6466
with:
@@ -71,9 +73,10 @@ jobs:
7173
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
7274
GITHUB_ACTIONS: 'true'
7375
run: |
76+
set -euo pipefail
7477
if [ -z "$ANTHROPIC_API_KEY" ]; then
7578
echo "ANTHROPIC_API_KEY not set - skipping automated update"
76-
echo "success=false" >> $GITHUB_OUTPUT
79+
echo "success=false" >> "$GITHUB_OUTPUT"
7780
exit 0
7881
fi
7982
@@ -110,15 +113,16 @@ jobs:
110113
set -e
111114
112115
if [ "$CLAUDE_EXIT" -eq 0 ]; then
113-
echo "success=true" >> $GITHUB_OUTPUT
116+
echo "success=true" >> "$GITHUB_OUTPUT"
114117
else
115-
echo "success=false" >> $GITHUB_OUTPUT
118+
echo "success=false" >> "$GITHUB_OUTPUT"
116119
fi
117120
118121
- name: Run tests
119122
id: tests
120123
if: steps.update.outputs.success == 'true'
121124
run: |
125+
set -euo pipefail
122126
set +e
123127
pnpm build 2>&1 | tee build-output.log
124128
BUILD_EXIT=${PIPESTATUS[0]}
@@ -128,19 +132,17 @@ jobs:
128132
set -e
129133
130134
if [ "$BUILD_EXIT" -eq 0 ] && [ "$TEST_EXIT" -eq 0 ]; then
131-
echo "success=true" >> $GITHUB_OUTPUT
135+
echo "success=true" >> "$GITHUB_OUTPUT"
132136
else
133-
echo "success=false" >> $GITHUB_OUTPUT
134137
{
138+
echo "success=false"
135139
echo "BUILD_LOG<<GHEOF"
136140
tail -50 build-output.log
137141
echo "GHEOF"
138-
} >> $GITHUB_OUTPUT
139-
{
140142
echo "TEST_LOG<<GHEOF"
141143
tail -50 test-output.log
142144
echo "GHEOF"
143-
} >> $GITHUB_OUTPUT
145+
} >> "$GITHUB_OUTPUT"
144146
fi
145147
146148
- name: Fix test failures (sonnet)
@@ -153,6 +155,7 @@ jobs:
153155
BUILD_LOG: ${{ steps.tests.outputs.BUILD_LOG }}
154156
TEST_LOG: ${{ steps.tests.outputs.TEST_LOG }}
155157
run: |
158+
set -euo pipefail
156159
set +e
157160
# Assemble prompt via Node so log contents with shell metacharacters
158161
# ($(...), backticks) cannot be interpreted by the shell.
@@ -187,9 +190,9 @@ jobs:
187190
set -e
188191
189192
if [ "$CLAUDE_EXIT" -eq 0 ]; then
190-
echo "success=true" >> $GITHUB_OUTPUT
193+
echo "success=true" >> "$GITHUB_OUTPUT"
191194
else
192-
echo "success=false" >> $GITHUB_OUTPUT
195+
echo "success=false" >> "$GITHUB_OUTPUT"
193196
fi
194197
195198
- name: Set final status
@@ -200,20 +203,22 @@ jobs:
200203
TESTS_SUCCESS: ${{ steps.tests.outputs.success }}
201204
FIX_SUCCESS: ${{ steps.claude.outputs.success }}
202205
run: |
206+
set -euo pipefail
203207
if [ "$UPDATE_SUCCESS" != "true" ]; then
204-
echo "success=false" >> $GITHUB_OUTPUT
208+
echo "success=false" >> "$GITHUB_OUTPUT"
205209
elif [ "$TESTS_SUCCESS" = "true" ]; then
206-
echo "success=true" >> $GITHUB_OUTPUT
210+
echo "success=true" >> "$GITHUB_OUTPUT"
207211
elif [ "$FIX_SUCCESS" = "true" ]; then
208-
echo "success=true" >> $GITHUB_OUTPUT
212+
echo "success=true" >> "$GITHUB_OUTPUT"
209213
else
210-
echo "success=false" >> $GITHUB_OUTPUT
214+
echo "success=false" >> "$GITHUB_OUTPUT"
211215
fi
212216
213217
- name: Validate changes
214218
id: validate
215219
if: steps.final.outputs.success == 'true'
216220
run: |
221+
set -euo pipefail
217222
UNEXPECTED=""
218223
for file in $(git diff --name-only origin/main..HEAD); do
219224
case "$file" in
@@ -224,15 +229,16 @@ jobs:
224229
if [ -n "$UNEXPECTED" ]; then
225230
echo "::warning::Non-dependency files modified:$UNEXPECTED"
226231
fi
227-
echo "valid=true" >> $GITHUB_OUTPUT
232+
echo "valid=true" >> "$GITHUB_OUTPUT"
228233
229234
- name: Check for changes
230235
id: changes
231236
run: |
237+
set -euo pipefail
232238
if [ -n "$(git status --porcelain)" ] || [ "$(git rev-list --count HEAD ^origin/main)" -gt 0 ]; then
233-
echo "has-changes=true" >> $GITHUB_OUTPUT
239+
echo "has-changes=true" >> "$GITHUB_OUTPUT"
234240
else
235-
echo "has-changes=false" >> $GITHUB_OUTPUT
241+
echo "has-changes=false" >> "$GITHUB_OUTPUT"
236242
fi
237243
238244
- name: Push branch
@@ -247,6 +253,7 @@ jobs:
247253
GH_TOKEN: ${{ github.token }}
248254
BRANCH_NAME: ${{ steps.branch.outputs.branch }}
249255
run: |
256+
set -euo pipefail
250257
COMMITS=$(git log --oneline origin/main..HEAD)
251258
COMMIT_COUNT=$(git rev-list --count origin/main..HEAD)
252259
@@ -275,11 +282,14 @@ jobs:
275282
env:
276283
BRANCH_NAME: ${{ steps.branch.outputs.branch }}
277284
run: |
285+
set -euo pipefail
278286
COMMIT_COUNT=$(git rev-list --count origin/main..HEAD)
279-
echo "## Weekly Update Complete" >> $GITHUB_STEP_SUMMARY
280-
echo "" >> $GITHUB_STEP_SUMMARY
281-
echo "**Branch:** \`${BRANCH_NAME}\`" >> $GITHUB_STEP_SUMMARY
282-
echo "**Commits:** ${COMMIT_COUNT}" >> $GITHUB_STEP_SUMMARY
287+
{
288+
echo "## Weekly Update Complete"
289+
echo ""
290+
echo "**Branch:** \`${BRANCH_NAME}\`"
291+
echo "**Commits:** ${COMMIT_COUNT}"
292+
} >> "$GITHUB_STEP_SUMMARY"
283293
284294
- name: Upload Claude output
285295
if: always()
@@ -309,6 +319,7 @@ jobs:
309319
HAS_UPDATES: ${{ needs.check-updates.outputs.has-updates }}
310320
DRY_RUN: ${{ inputs.dry-run }}
311321
run: |
322+
set -euo pipefail
312323
if [ "$HAS_UPDATES" = "true" ]; then
313324
if [ "$DRY_RUN" = "true" ]; then
314325
echo "Updates available (dry-run mode - no PR created)"

0 commit comments

Comments
 (0)