World map

 

BM: Baca dalam Bahasa Melayu

World 5: Teamwork

Rulesets, protection, CODEOWNERS

You will learn: how rules keep main safe, and how CODEOWNERS picks reviewers.

The problem

Sam merged his own PR at midnight. Its test had failed. The club site broke! How can the team stop this?

Pick one answer.

Try it

branch protection: Rules on a branch, like: no merging without a review and passing checks. puts rules on a branch. Turn on the rule that needs checks to pass. Then look at Sam’s PR.

Practice repo — not a real website
kelab-kod / club-site
Rules for main

Watch

A ruleset: A named list of rules for branches or tags. Several rulesets can apply at once. is the newer way to add rules. Rulesets can stack on one branch. Sort each fact.

Drag a card into a box. Or tap the card, then tap the box.

      Watch

      cat shows the CODEOWNERS file. Line one: star, at-aina. Then star dot css, at-mei. Then slash docs slash, at-ravi. Terminal output: $ cat .github/CODEOWNERS # Aina reviews everything... * @aina # ...except these. *.css @mei /docs/ @ravi

      A CODEOWNERS: A file that says who owns which files. Owners are asked to review changes to them. file says who owns which files. GitHub asks those owners to review changes to their files. Automatically!

      Predict

      A PR changes style.css. Who gets asked to review?

      Pick one answer.

      Check

      Good rule for main, or needs work? Swipe each one.

      Swipe right for good, left for needs work. Or use the buttons.

      1 / 4

      Require one approving review

      Require one approving review

      You did it!

      You can now protect main with rules and pick reviewers with CODEOWNERS.

      Go deeper (optional)

      Rules can also require code owner reviews, resolved comments or signed commits. Force pushes and deleting a protected branch are blocked by default. Code owners need write access to the repo. The CODEOWNERS file can live in .github/, the top folder or docs/. Rulesets can let chosen people or apps skip a rule.