AI Hints
CI/CD with GitHub Actions · Lesson 28 of 138

Fixing the Build

Back to green.

⏱ 2 min read▶ Video at 31:32🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

A red build is a team's top priority. Until it's fixed, nobody can trust the pipeline, and every new change is blocked. The fix might be a code change, or a revert. Either way, the goal is to get back to green fast.

Fixing the Build
From the video: Fixing the Build
  • Red is top priority
  • Nobody can trust it
  • Back to green fast

Revert the mistake

The fastest fix is often to undo the bad commit. Git revert creates a new commit that reverses it, without rewriting history. The log shows the revert on top. And the pipeline runs again, and it's green. Investigate calmly afterwards, with the build working.

Terminal
git revert --no-edit HEAD
[main 4de2d98] Revert "Update tax"
 Date: Mon Jan 5 09:00:00 2026 +0000
 1 file changed, 1 insertion(+), 1 deletion(-)
git log --oneline
4de2d98 Revert "Update tax"
66a6c8a Update tax
c0fd447 First version of the shop
run-steps .github/workflows/ci.yml | tail -4
  ✓ Run tests
      ...                                                                                [100%]
      3 passed in 0.01s
  Job succeeded

Good habits

Run the tests on your machine before you push. Keep changes small, so a failure is easy to find. Fix or revert a broken build straight away. And never ignore a red build, or turn a test off just to make it pass. If a test is wrong, fix the test, and explain why in the commit.

keyvalue
Test before pushcatch it early
Small changeseasy to debug
Fix or revertstraight away
Never ignore redtrust the pipeline

Summary

When the build breaks, fix it or revert it straight away, so the pipeline stays trustworthy. Next, catching workflow mistakes before you push.

Key takeaways
  • git revert
  • Back to green
  • Small changes
Next up: Checking Workflows — actionlint