November 25, 2026 路 #70
The green build with red tests
Tests fail on main, yet the deploy job still runs and the workflow shows green. Which line allows this?
name: ci
on:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
continue-on-error: true
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- run: ./deploy.shNext puzzle in UTC
One try. The first answer sticks.
How to fix it
continue-on-error: true lets the job proceed and report success even when the step exits non-zero. The test job therefore succeeds, and needs: test lets deploy run. Remove the line.
continue-on-error: true tells GitHub Actions to treat a step failure as if it succeeded: the job carries on and ends with a success status. That is useful for an experimental or advisory step, but on npm test it silently turns a failing test suite into a passing job.
Because deploy uses needs: test and the test job is now green, the deploy starts. The log of the test step still shows the failure, but nothing blocks the release.
Note that needs does require the earlier job to succeed by default. It only runs a dependent job after a failure if you add if: always().
Fix
- run: npm test
If you want a non-blocking check, keep it in a separate job that deploy does not depend on, and make required checks explicit in branch protection. Before you trust a green check, open the run and confirm which steps actually passed.