GH-100 · Domain 2: Administer GitHub Enterprise environment · 14% of the exam
Task 2.2: Recommend standards for developer processes
Branching, review and release standards, code owners, and the rulesets and templates that make them the default across an organization.
Study it
Branching, review and release standards with code owners and rulesets
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the GitHub documentation page that proves it.
Question 1 · choose 1
A repository's review standard says that pull requests changing infra/ need the platform team's approval before they merge into main or into any release branch. A ruleset targets main and release/** and requires one approving review, with "Require review from Code Owners" selected. The CODEOWNERS file, added to .github/ on main last month, assigns infra/ to the platform team. Pull requests into main wait for the platform team as intended, but pull requests into release/4.2, which was cut from main two months ago, merge after one approval from any developer. Why?
ARelease/4.2 has no CODEOWNERS file, and a pull request takes its code owners from its base branch
BRequiring review from code owners applies only to pull requests into the default branch, where the CODEOWNERS file is
CMain's CODEOWNERS file assigns the platform team on release/4.2 too, but there the rule accepts any developer's approval
DThe rule requires a code owner's approval only after someone requests the code owners as reviewers by hand
Show the answer and why
ARelease/4.2 has no CODEOWNERS file, and a pull request takes its code owners from its base branch
Correct
Without a code owner on the base branch, the rule has no owner whose approval it can require.
BRequiring review from code owners applies only to pull requests into the default branch, where the CODEOWNERS file is
Incorrect
Each branch can have its own code owners; the rule applies on every branch the ruleset targets.
CMain's CODEOWNERS file assigns the platform team on release/4.2 too, but there the rule accepts any developer's approval
Incorrect
Code owners come from the base branch's file, and where content has a code owner the rule requires that code owner's approval.
DThe rule requires a code owner's approval only after someone requests the code owners as reviewers by hand
Incorrect
The requirement applies to any pull request that modifies content with a code owner.
With "Require review from Code Owners", a pull request that modifies content with a code owner must be approved by that code owner before it merges. Code owners come from CODEOWNERS files: each file assigns owners for the branch it is on, and pull requests use the version from their base branch. A release branch cut before the file existed has no code owners, so its pull requests need only the general approval. Adding the file to the release branches closes the gap.
In a repository, the developers have write access and push every day. The release standard says that only the release-managers team may publish releases, and that every release gets a new tag following the pattern v*. Today any developer can draft and publish a release with a new v* tag. What should a repository administrator configure?
AA branch ruleset on main that requires a pull request approved by a member of release-managers
BA CODEOWNERS entry that makes release-managers the owner of the changelog file
CA tag ruleset for v* with Restrict creations, and release-managers on its bypass list
DA tag ruleset for v* with Restrict deletions, and release-managers on its bypass list
Show the answer and why
AA branch ruleset on main that requires a pull request approved by a member of release-managers
Incorrect
Releases are based on tags; protecting main doesn't stop a developer from creating a release tag.
BA CODEOWNERS entry that makes release-managers the owner of the changelog file
Incorrect
Code owners are requested to review pull requests; they don't decide who creates tags or releases.
CA tag ruleset for v* with Restrict creations, and release-managers on its bypass list
Correct
Only people with bypass permission can then create tags matching v*, which every new release needs.
DA tag ruleset for v* with Restrict deletions, and release-managers on its bypass list
Incorrect
That rule only stops matching tags from being deleted; developers can still create them.
Anyone with write permission to a repository can manage its releases, and each release is based on a Git tag, which can be created while drafting the release. A tag ruleset that targets v* with Restrict creations lets only users with bypass permission create matching tags, so only release-managers can publish such releases.
A team's branching standard says the history of main must stay linear, so a ruleset on main requires linear history. The repository currently allows only merge commits. What must change before the rule can work?
ANothing; the rule rewrites merge commits into a linear history
BAllow force pushes to main so history can be rewritten
CAllow squash merging or rebase merging in the repository
DRequire signed commits on main as well
Show the answer and why
ANothing; the rule rewrites merge commits into a linear history
Incorrect
The rule blocks merge commits; it doesn't rewrite them.
BAllow force pushes to main so history can be rewritten
Incorrect
Force pushes don't satisfy a linear history requirement and are blocked by default.
CAllow squash merging or rebase merging in the repository
Correct
A linear history needs squash or rebase merges, so one of them must be allowed.
DRequire signed commits on main as well
Incorrect
Signing proves who made commits; it doesn't change how pull requests merge.
Requiring a linear commit history prevents merge commits from being pushed to the targeted branches, so pull requests must be merged with a squash merge or a rebase merge. Before you can require it, the repository must allow squash merging or rebase merging.
A ruleset on main requires review from code owners. In CODEOWNERS, the line for /api/ names two teams, @octo-org/api-core and @octo-org/security. A pull request changes files under /api/. What does the code owner requirement need?
AAn approval from a code owner in either team
BOne approval from each of the two teams
CApprovals from every member of both teams
DNo code owner approval, because two owners cancel the requirement
Show the answer and why
AAn approval from a code owner in either team
Correct
When code has multiple owners, an approval from any of them meets the requirement.
BOne approval from each of the two teams
Incorrect
An approval from any one of the code owners is enough.
CApprovals from every member of both teams
Incorrect
The requirement needs one code owner approval, not every member's.
DNo code owner approval, because two owners cancel the requirement
Incorrect
Multiple owners don't cancel it; any one of them can approve.
With required review from code owners, a pull request that modifies content with a code owner must be approved by that code owner before it can be merged. If the code has multiple owners, an approval from any of the code owners is sufficient.
An organization on GitHub Enterprise Cloud adopts a standard that every commit message on main must contain an issue number. Which ruleset rule enforces this?
ARequire a pull request before merging, with at least one approval
BRequire signed commits
CA metadata restriction with a pattern for commit messages
DRequire status checks to pass
Show the answer and why
ARequire a pull request before merging, with at least one approval
Incorrect
That rule requires pull requests; it doesn't check commit message formats.
BRequire signed commits
Incorrect
Signing verifies commits; it doesn't check what their messages contain.
CA metadata restriction with a pattern for commit messages
Correct
Metadata restrictions can require that commit messages match a pattern, such as an issue number.
DRequire status checks to pass
Incorrect
Status checks report CI results; they aren't a commit message rule.
Organizations on a GitHub Enterprise plan can add metadata restrictions to rulesets, with literal strings or regular expressions that commit metadata must match, for example that commit messages contain an issue number. They are enforced for new commits pushed from then on, not for existing history.