Skip to content
Search 1.3

Review rules for main

This runbook records the current review rules and explains how the repository owner can update them. The solo-maintainer settings were applied and verified in #335. A fresh read on 2026-11-16 confirms strict status checks and the four preserved check contexts. The solo-maintainer policy keeps merges possible with one maintainer. The independent-review policy requires a second person with write access. Neither policy adds collaborators or changes accounts.

With only @jonathanagustin able to review, keep required_approving_review_count: 0, require_code_owner_review: false, and require_last_push_approval: false. GitHub does not count the author’s own approval. Enabling these requirements would block the owner’s pull requests. Leave the existing stale-review dismissal and conversation resolution on.

The selected policy also applies two protections that work for a solo maintainer:

  • Remove the administrator bypass (bypass_actors: []) so administrators must use pull requests and pass the required checks.
  • Require the branch to be up to date (strict_required_status_checks_policy: true) so those checks cover the current base branch.

Keep all four existing checks, deletion protection, force-push protection, and allowed merge methods. The following procedure remains available if these settings need to be restored. Save the current ruleset using the backup command below, then generate the solo update from that backup:

Terminal window
jq '{name, target, enforcement, conditions, rules, bypass_actors: []}
| .rules |= map(
if .type == "required_status_checks" then
.parameters.strict_required_status_checks_policy = true
else . end
)' ruleset-25580922-backup.json > ruleset-25580922-solo.json

Before applying the update, confirm the saved pull-request rule has zero required approvals, no required code-owner review, and no last-push approval. Confirm the only bypass being removed is the administrator role. If the read omits bypass_actors, stop: that connection cannot provide a complete backup.

Apply with an account or token that can administer this repository:

Terminal window
gh api --method PUT \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2026-03-10" \
repos/jonathanagustin/uds-takserver/rulesets/25580922 \
--input ruleset-25580922-solo.json

Read the ruleset again with GET and verify the empty bypass list, strict status checks, unchanged four checks, and the zero-approval pull-request rule. A 403 Resource not accessible by integration means the connection lacks settings write access; a successful GET alone does not establish that it can update.

The Branch-Protection alert can still report missing approvers, code-owner reviews, and last-push approval under this policy. Those are documented limits of maintaining this repository alone. Do not add a bot or self-approval to simulate an independent review, or disable the check to hide the result.

The Code-Review alert measures approval evidence in recent changesets. The current retained Scorecard result reports 0/30 approved changesets; changing branch rules does not retroactively approve those changes. Raising that score requires real independent reviews of future changes. Revisit the independent-review policy when a second human collaborator is available.

The sections below describe that stricter, optional policy and the common backup and restore procedure.

GitHub’s rule reference: Available rules for rulesets. The application programming interface (API) is representational state transfer (REST) API endpoints for rules (X-GitHub-Api-Version: 2026-03-10). Reviews: Approving a pull request with required reviews.

Read on 2026-11-16 from GET /repos/jonathanagustin/uds-takserver/rulesets/25580922.

The ruleset is named main, id 25580922, enforcement active, target branch, and it includes ~DEFAULT_BRANCH.

The pull request rule requires a pull request. Approving reviews required: 0. Code owner review: off. Approval of the most recent push: off. Dismiss stale approvals when new commits are pushed: already on. Conversation resolution: on. Allowed merges: squash and rebase. The unattributed-Copilot extra approval is off. The required-reviewers list is empty.

Status checks are hk, Analyze (actions), Analyze (javascript-typescript), and dependency-review, each with integration_id 15368 (GitHub Actions). The branch must be up to date with the base (strict_required_status_checks_policy is true). Deletion and force-push are blocked.

That read did not include bypass_actors, so it cannot establish the current complete bypass list. The last administration-capable verification in #335 recorded an empty list after removing the earlier repository-admin bypass. current_user_can_bypass on the fresh read was never; this describes only the reading account.

Scorecard run 44016456793 analyzed main commit 2a9262af8cbd708b180e8f68763a74a09c22be4a. Its retained SARIF file artifact contains results.sarif with SHA-256 41122610adb204758e407d8f8236067e59631018679ce5d301c4ba064cc14494. The two relevant results are:

Check Score Current evidence
Branch-Protection 4 Missing required approvers, code-owner review and last-push approval
Code-Review 0 0/30 approved changesets

These are the expected approval limitations of the selected solo-maintainer policy. The latest ten merged PRs inspected in the review also had no submitted approvals. The result does not show missing strict status checks. Keep the working protections and the existing policy until a real second human reviewer is available; adding an approval requirement would block the maintainer’s own PRs.

This disposition uses the current run’s SARIF and the ruleset readback. The reading account cannot inspect the live code-scanning alert records, so it does not establish their current state or dismiss them. The earlier failed settings write is historical; no settings change was attempted during this review.

A classic branch-protection read of main returned HTTP 403 to the token used for this check. This runbook updates the ruleset. It does not call the branch-protection API.

Keep the pull request rule, the four checks, deletion block, force-push block, squash and rebase, conversation resolution, and stale-review dismissal. Change only the following.

Choice Send
One human approval required_approving_review_count 1
Dismiss stale approvals dismiss_stale_reviews_on_push true (already on)
Approval after the latest push require_last_push_approval true, if the API accepts it
Admins follow the rules bypass_actors []
Branch matches the latest base strict_required_status_checks_policy true
Code owners require_code_owner_review false until the step below
Named reviewers required_reviewers []

Leave require_extra_approval_for_unattributed_changes false. That field is a Copilot preview setting, and it is false today.

GitHub’s review docs say pull request authors cannot approve their own pull requests, and a GitHub Copilot review does not count toward required approvals. A different person with write access must submit the approving review.

require_last_push_approval means the most recent reviewable push must be approved by someone other than the person who pushed it. The approval has to be submitted after that push. An earlier approval does not cover a later push. The same reviewer can approve again after the push.

With stale-review dismissal also on, a new push drops existing approvals. The other person then approves again, after that push. Updating the branch from main changes the diff and can dismiss the approval the same way. Your own approval still does not count.

If the PUT responds 422 and the message names require_last_push_approval, this account did not accept that field. Send the same body with that field false. The approval count, the empty bypass list, and the up-to-date check can still go on. Read the error once. Do not keep retrying.

CODEOWNERS lists only @jonathanagustin. Leave code owner review off. Turning it on with that file would ask the pull request author to approve their own change, which GitHub does not count.

Code owner review is optional. Use it only after CODEOWNERS names a second human account, a real person with write access, and that person is not the author of the pull request you need to merge. Write their GitHub login in CODEOWNERS. Do not list an app or a bot. Dependabot, Renovate, Copilot, and GitHub Actions are not that second person. Merge the CODEOWNERS change first. Only then set require_code_owner_review to true in a later update. Until then, send false.

Use gh auth login as the repository owner, or a token that can administer this repository. Do not commit the token or the backup file. GitHub hides bypass_actors from a token that cannot edit the ruleset. If the saved JavaScript Object Notation (JSON) has no bypass_actors key, stop.

Terminal window
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2026-03-10" \
repos/jonathanagustin/uds-takserver/rulesets/25580922 \
> ruleset-25580922-backup.json

The same call with curl:

Terminal window
curl -fsSL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/jonathanagustin/uds-takserver/rulesets/25580922 \
-o ruleset-25580922-backup.json

Read bypass_actors in that file. The admin entry should have "bypass_mode": "pull_request". If any other actor is in the list, an empty bypass list removes that actor too. Stop and edit the list by hand in that case. The target of this runbook is an empty list, so admins are included.

PUT /repos/jonathanagustin/uds-takserver/rulesets/25580922 replaces this ruleset. It does not create another one. Write this to ruleset-25580922-strict.json.

{
"name": "main",
"target": "branch",
"enforcement": "active",
"bypass_actors": [],
"conditions": {
"ref_name": {
"include": ["~DEFAULT_BRANCH"],
"exclude": []
}
},
"rules": [
{ "type": "deletion" },
{ "type": "non_fast_forward" },
{
"type": "pull_request",
"parameters": {
"allowed_merge_methods": ["squash", "rebase"],
"dismiss_stale_reviews_on_push": true,
"require_code_owner_review": false,
"require_extra_approval_for_unattributed_changes": false,
"require_last_push_approval": true,
"required_approving_review_count": 1,
"required_review_thread_resolution": true,
"required_reviewers": []
}
},
{
"type": "required_status_checks",
"parameters": {
"do_not_enforce_on_create": false,
"strict_required_status_checks_policy": true,
"required_status_checks": [
{ "context": "hk", "integration_id": 15368 },
{ "context": "Analyze (actions)", "integration_id": 15368 },
{ "context": "Analyze (javascript-typescript)", "integration_id": 15368 },
{ "context": "dependency-review", "integration_id": 15368 }
]
}
}
]
}
Terminal window
gh api --method PUT \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2026-03-10" \
repos/jonathanagustin/uds-takserver/rulesets/25580922 \
--input ruleset-25580922-strict.json
Terminal window
curl -fsSL -X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/jonathanagustin/uds-takserver/rulesets/25580922 \
--data-binary @ruleset-25580922-strict.json

If last-push approval is rejected, change only "require_last_push_approval" to false in that file and send the PUT once more.

Then GET the ruleset again. You want required_approving_review_count 1, bypass_actors [], strict_required_status_checks_policy true, and the same four checks. require_last_push_approval is true only when the PUT that set it was accepted. In the site user interface (UI) this is Settings, Rules, Rulesets, main: one required approval, dismiss stale approvals, require approval of the most recent reviewable push, code owner review off, the four status checks, require branches to be up to date, and an empty bypass list.

Restore from ruleset-25580922-backup.json, the GET you saved before the change. That file is the full ruleset, including bypass_actors. Do not restore from the reference copy at the bottom of this page. That copy has no bypass list.

The update endpoint does not take the read-only fields. Strip them, then PUT.

Terminal window
jq 'del(._links, .id, .node_id, .source, .source_type, .created_at, .updated_at, .current_user_can_bypass)' \
ruleset-25580922-backup.json > ruleset-25580922-restore.json
gh api --method PUT \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2026-03-10" \
repos/jonathanagustin/uds-takserver/rulesets/25580922 \
--input ruleset-25580922-restore.json

If PUT returns 422 and names an unsupported field, remove only that field from ruleset-25580922-restore.json and send it once more. GET the ruleset and compare rules and bypass_actors to the backup.

This is the GET body returned to a caller who could not see bypass_actors. It is a record of the rules. It is not the restore file.

{
"name": "main",
"target": "branch",
"enforcement": "active",
"conditions": {
"ref_name": {
"include": ["~DEFAULT_BRANCH"],
"exclude": []
}
},
"rules": [
{ "type": "deletion" },
{ "type": "non_fast_forward" },
{
"type": "pull_request",
"parameters": {
"allowed_merge_methods": ["squash", "rebase"],
"dismiss_stale_reviews_on_push": true,
"require_code_owner_review": false,
"require_extra_approval_for_unattributed_changes": false,
"require_last_push_approval": false,
"required_approving_review_count": 0,
"required_review_thread_resolution": true,
"required_reviewers": []
}
},
{
"type": "required_status_checks",
"parameters": {
"do_not_enforce_on_create": false,
"strict_required_status_checks_policy": false,
"required_status_checks": [
{ "context": "hk", "integration_id": 15368 },
{ "context": "Analyze (actions)", "integration_id": 15368 },
{ "context": "Analyze (javascript-typescript)", "integration_id": 15368 },
{ "context": "dependency-review", "integration_id": 15368 }
]
}
}
]
}