Project 2 โ€บ 09 Status badges & branch protectionGitHub โ†—
๐Ÿค– AI Prompt โ€” stuck? paste this

โ€œGive me the markdown for a GitHub Actions status badge for a workflow named CI, and explain how to make CI a required status check on main.โ€

09 โ€” [Optional] Status badges & branch protection

Category: Polish ยท Priority: Low ยท Step: 10 ยท Optional

Show a green build badge in your README and require CI to pass before merging.

๐ŸŽฏ What is this task?

Two finishing touches that make a repo look (and behave) professional:

  1. A status badge in your README that shows live CI status.
  2. Branch protection that blocks merging a pull request until CI is green.

๐Ÿค– AI Prompt

"Give me the markdown for a GitHub Actions status badge for my workflow named CI, and explain how to make CI a required status check on the main branch."

๐Ÿ“‹ Step-by-step

Status badge โ€” add to the top of README.md:

![CI](https://github.com/OWNER/REPO/actions/workflows/ci.yml/badge.svg)

Replace OWNER/REPO with your repo path. The badge turns green/red automatically.

Branch protection

Repo โ†’ Settings โ†’ Branches โ†’ Add branch ruleset (or classic protection rule) for main:

  • โœ… Require a pull request before merging
  • โœ… Require status checks to pass โ†’ select your test check
  • โœ… Require branches to be up to date before merging

Now a red pipeline physically blocks the Merge button.

โœ… Done when

  • A CI badge shows in your README
  • main requires the test check to pass before merge
  • A failing PR cannot be merged

๐Ÿ“ Quiz

Answer all 1 questions correctly to complete this lesson.

1. What does requiring a status check on main accomplish?
โ† PreviousPass the quiz to completeNext โ†’