Skip to content

fix(ci): fail health check when sitemap route checks fail - #50

Merged
dralgorhythm merged 1 commit into
mainfrom
claude/exciting-wilbur-8cabcf
Jul 21, 2026
Merged

fix(ci): fail health check when sitemap route checks fail#50
dralgorhythm merged 1 commit into
mainfrom
claude/exciting-wilbur-8cabcf

Conversation

@dralgorhythm

Copy link
Copy Markdown
Owner

Summary

The "Check site availability" step in .github/workflows/health-check.yml could never fail on a broken sitemap route. The per-route loop was fed by a pipe:

echo "$CHECKS" | jq -c '.[]' | while read -r check; do ... FAILED=1 ... done

A pipeline runs the while in a subshell, so FAILED=1 set inside it never propagates to the parent shell — the final if [ $FAILED -eq 1 ] always saw 0. 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:

while read -r check; do ... done < <(echo "$CHECKS" | jq -c '.[]')

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 default run shell 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: FAILED is also assigned outside the loop, which masks SC2031.)
  • bash -n on the extracted step script: syntax OK.
  • Ran the actual extracted step scripts (old from HEAD, new from this branch) under bash -e with a stubbed curl on PATH:
    • Old script, one route down → prints but exits 0 (bug reproduced)
    • New script, one route down → same log output, exits 1
    • New script, all healthy → all , exits 0

🤖 Generated with Claude Code

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>
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Preview Build Ready

Build Status: ✅ Success
Node Version: 24

📦 Preview artifact uploaded - check the Actions tab to download.

This preview was built from commit e3a34eb

@dralgorhythm
dralgorhythm merged commit 7aa0fa4 into main Jul 21, 2026
5 checks passed
@dralgorhythm
dralgorhythm deleted the claude/exciting-wilbur-8cabcf branch July 21, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant