Skip to content

Commit 4dc6f2b

Browse files
committed
fix(publish): make retry_publish surface failure output under bash -e
Both retry_publish functions captured command output via: output=$("$@" 2>&1) rc=$? echo "$output" GitHub Actions launches bash with -e (errexit). Under set -e, a failing command substitution can terminate the script before the next line runs. That meant when vsce or ovsx returned non-zero, the script died at the `output=$(...)` line — neither the captured output nor the retry/ classification logic ever executed. The job just exited with code 1 showing only the '##[group]vsce publish attempt 1/5' header. The previous single-target version of this workflow had the same bug latent; it never triggered because vsce always succeeded for that flow. The new multi-target run hit a real vsce failure and the bug ate the diagnostic. Replace the bare assignment with an explicit if/else, which set -e is documented to handle correctly: if output=$("$@" 2>&1); then rc=0; else rc=$?; fi echo "$output" No version bump — 0.2.2 was never on the Marketplace (vsce publish silently failed for all 4 targets), so the prepare gate will let a re-run through. ovsx already has 0.2.2 for all targets and will return 'already exists' which retry_publish treats as idempotent success.
1 parent 46ea89b commit 4dc6f2b

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,12 @@ jobs:
239239
local i output rc wait
240240
for (( i=1; i<=attempts; i++ )); do
241241
echo "::group::vsce publish attempt $i/$attempts (${{ matrix.target }})"
242-
output=$("$@" 2>&1)
243-
rc=$?
242+
# The if/else is load-bearing: GitHub runs `bash -e`, and a
243+
# failed command substitution `output=$(cmd)` under set -e
244+
# terminates the script *before* the echo below can run, so
245+
# vsce/ovsx errors get swallowed silently. The if-form is
246+
# explicitly handled by set -e and lets both branches set rc.
247+
if output=$("$@" 2>&1); then rc=0; else rc=$?; fi
244248
echo "$output"
245249
echo "::endgroup::"
246250
@@ -302,8 +306,12 @@ jobs:
302306
local i output rc wait
303307
for (( i=1; i<=attempts; i++ )); do
304308
echo "::group::ovsx publish attempt $i/$attempts (${{ matrix.target }})"
305-
output=$("$@" 2>&1)
306-
rc=$?
309+
# The if/else is load-bearing: GitHub runs `bash -e`, and a
310+
# failed command substitution `output=$(cmd)` under set -e
311+
# terminates the script *before* the echo below can run, so
312+
# vsce/ovsx errors get swallowed silently. The if-form is
313+
# explicitly handled by set -e and lets both branches set rc.
314+
if output=$("$@" 2>&1); then rc=0; else rc=$?; fi
307315
echo "$output"
308316
echo "::endgroup::"
309317

0 commit comments

Comments
 (0)