ci(frontend): fast-fail build sentinel on push to protected branches (closes #177)#179
Conversation
Closes #177. Pre-commit's `Build frontend` hook catches local edits that break the build, but it does NOT run for: - rebases, - merge commits authored via the GitHub UI, or - push races where two commits interleave in an unintended order. PR #160 → #172 was the motivating incident: a rebase silently orphaned the `formatRelativeTime` import, pre-commit didn't re-run, the merge landed, and the per-cloud deploys all failed ~30 minutes later in their Docker `frontend-builder` stage. Adds `.github/workflows/frontend-build-sentinel.yml`: - triggers on push to `main` and `feat/**`, - runs `npm ci`, `tsc --noEmit`, `npm run build`, and `jest --no-coverage --silent` in `frontend/`, - cancels in-progress runs on the same ref so successive pushes only build the latest tip, - 5-minute timeout cap. Run time on warm cache: ~30s. Cost: negligible. Effect: a broken frontend build fires within ~1 min of landing on the protected branch, well before the deploys hit the same failure.
|
@coderabbitai review |
📝 WalkthroughWalkthroughA new GitHub Actions workflow is introduced that triggers on pushes to main and feat/\* branches. It performs frontend build validation by installing dependencies, running TypeScript typecheck, building the frontend, and executing Jest tests, with per-ref concurrency management and npm caching. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/frontend-build-sentinel.yml (1)
42-46: Pin GitHub Actions to immutable commit SHAs for supply-chain security.Lines 42 and 45 use mutable version refs (
@v5,@v6). Pinning to commit SHAs prevents silent behavior drift when maintainers update version tags and reduces supply-chain risk.Update:
- Line 42:
actions/checkout@v5→ pin to full SHA of v6- Line 45:
actions/setup-node@v6→ pin to full SHA of current v6.x release🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/frontend-build-sentinel.yml around lines 42 - 46, Replace the mutable action refs with immutable commit SHAs: update the uses value for actions/checkout (currently "actions/checkout@v5") to the full commit SHA corresponding to the v6 tag, and update the uses value for actions/setup-node (currently "actions/setup-node@v6") to the full commit SHA for the current v6.x release; locate these entries by searching for the strings "actions/checkout" and "actions/setup-node" in the workflow and substitute the tag refs with their respective full commit SHAs to pin the actions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/frontend-build-sentinel.yml:
- Around line 42-46: Replace the mutable action refs with immutable commit SHAs:
update the uses value for actions/checkout (currently "actions/checkout@v5") to
the full commit SHA corresponding to the v6 tag, and update the uses value for
actions/setup-node (currently "actions/setup-node@v6") to the full commit SHA
for the current v6.x release; locate these entries by searching for the strings
"actions/checkout" and "actions/setup-node" in the workflow and substitute the
tag refs with their respective full commit SHAs to pin the actions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3a540dbd-dec8-466f-b3fe-7cd8da0d2a30
📒 Files selected for processing (1)
.github/workflows/frontend-build-sentinel.yml
Summary
Closes #177 (P1, urgency:now, effort:xs).
Pre-commit's
Build frontendhook catches local edits that break the build, but it does NOT run for rebases, merge commits authored via the GitHub UI, or push races. PR #160 → #172 was the motivating incident: a rebase silently orphaned theformatRelativeTimeimport, pre-commit didn't re-run, the merge landed, and per-cloud deploys all failed ~30 minutes later in their Dockerfrontend-builderstage.What's added
.github/workflows/frontend-build-sentinel.yml:pushtomainandfeat/**branches.npm ci,npx tsc --noEmit,npm run build, andnpx jest --no-coverage --silentinsidefrontend/.actions/setup-node@v6withcache: 'npm'keyed onfrontend/package-lock.jsonso the warm path is sub-30s.concurrency: { group: 'frontend-build-${{ github.ref }}', cancel-in-progress: true }so successive pushes only build the latest tip.Effect
A broken frontend build now fires within ~1 minute of landing on the protected branch, well before the per-cloud deploys hit the same failure 30+ minutes later. Run cost is negligible (~30s warm, ~45s cold, single ubuntu-latest runner).
Verification
🤖 Generated with claude-flow
Summary by CodeRabbit