fix(ci): fail health check when sitemap route checks fail - #50
Merged
Conversation
The per-route loop in the "Check site availability" step piped jq output into `while read`, which runs the loop in a pipeline subshell. FAILED=1 set inside it never reached the parent shell, so the final exit check only reflected the robots.txt/sitemap.xml probes — an individual route outage could never fail the job. Feed the loop via process substitution instead, keeping it in the parent shell so route failures propagate. Log output (✅/❌ lines) is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
🔍 Preview Build ReadyBuild Status: ✅ Success 📦 Preview artifact uploaded - check the Actions tab to download.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The "Check site availability" step in
.github/workflows/health-check.ymlcould never fail on a broken sitemap route. The per-route loop was fed by a pipe:A pipeline runs the
whilein a subshell, soFAILED=1set inside it never propagates to the parent shell — the finalif [ $FAILED -eq 1 ]always saw0. Only the robots.txt/sitemap.xml probes (outside the loop) and the Lighthouse gate were actually enforced, defeating the workflow's main purpose (including the scheduled uptime run).Fix
Feed the loop via process substitution instead, keeping it in the parent shell:
Two-line change; ✅/❌ log output and all other behavior unchanged. Bash-only syntax is safe here — the step has no
shell:key and GitHub's defaultrunshell on ubuntu-latest is bash.Verification
actionlint(with embedded shellcheck): output byte-identical to the pre-change baseline — no new findings. (Shellcheck can't catch this bug itself:FAILEDis also assigned outside the loop, which masks SC2031.)bash -non the extracted step script: syntax OK.bash -ewith a stubbedcurlonPATH:❌but exits 0 (bug reproduced)✅, exits 0🤖 Generated with Claude Code