Sikau

GitHub Actions · Day 5 · about 30 min

When the build goes red

Read a failing run, fix the code, see it go green.

Red is useful

A red X on a pull request isn't a disaster — it's CI doing its job: catching a bug before it reaches customers. The skill is reading the log quickly and fixing the cause, not the symptom.

A failing run

function total(items) {
  return items.reduce((sum, item) => sum + item.price, 0);
}

function withVat(amount) {
  return Math.round(amount * 1.13);
}

module.exports = { total, withVat };
  • Find the first failed step (✗) — later steps were skipped.
  • Inside it, look for the assertion: expected vs actual values.
  • Reproduce locally (npm test), fix, push again — the same PR re-runs CI.
  • Branch protection can require green checks before merging.

The rest of this lesson

  • Reading a test failureexplain
  • Fix the cause, not the testexplain
  • Read the failurepredict
  • From red to greenorder
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 12 lessons of GitHub Actions