Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions documentation/docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ PR code, never holds `contents: write`, `pages` or `id-token`.
[Private flake inputs](#private-flake-inputs).
5. Apply the ruleset, which requires **`ci / flake-check`**, see
[Ruleset](#ruleset).
6. Settings → General → Pull Requests: **Allow auto-merge** and
**Automatically delete head branches**
(`gh api -X PATCH repos/external-systems/<repo> -F allow_auto_merge=true -F delete_branch_on_merge=true`).

The status check is named `<caller job id> / <job id>`. Keep the caller
job id `ci` in every repo so one ruleset fits all of them.
Expand Down Expand Up @@ -165,12 +168,24 @@ The org-standard branch ruleset for `main`, the one pkgs runs. New repos get it
{
"type": "required_status_checks",
"parameters": {
"strict_required_status_checks_policy": true,
"strict_required_status_checks_policy": false,
"do_not_enforce_on_create": false,
"required_status_checks": [
{ "context": "ci / flake-check", "integration_id": 15368 }
]
}
},
{
"type": "merge_queue",
"parameters": {
"merge_method": "SQUASH",
"grouping_strategy": "ALLGREEN",
"max_entries_to_build": 5,
"min_entries_to_merge": 1,
"max_entries_to_merge": 5,
"min_entries_to_merge_wait_minutes": 0,
"check_response_timeout_minutes": 60
}
}
],
"bypass_actors": [
Expand All @@ -179,16 +194,19 @@ The org-standard branch ruleset for `main`, the one pkgs runs. New repos get it
}
```

- `strict_required_status_checks_policy: true` ("Require branches to be
up to date"): a PR's check must have passed against the current
`main`, so two PRs that pass alone can't break it together.
- `merge_queue`: auto-merge puts a green PR in the queue, which runs
`ci / flake-check` (`merge_group` in `ci.yml`) on the PR on top of the
current `main` and the PRs ahead of it, then squash-merges. Two PRs that
pass alone can't break `main` together, and no one has to update a
branch that fell behind. Squash, because a merge-commit queue conflicts
with linear history.
- `strict_required_status_checks_policy: false`: the queue does the
"up to date" job. With `true` and no queue, auto-merge stalls on
"Required to update" every time another PR merges first.
- `bypass_mode: pull_request` lets an admin merge a PR past the rules
but not push straight to `main`.
- `integration_id` 15368 is GitHub Actions, so only Actions can satisfy
the check.
- A **merge queue** works too: `ci.yml` runs on `merge_group`. If you add
one, set its merge method to squash, because a merge-commit queue
conflicts with linear history.
- Apply to one repo with
`gh api -X POST repos/external-systems/<repo>/rulesets --input .github/rulesets/default.json`
(or `PUT .../rulesets/<id>` to replace an existing one). Org-wide:
Expand Down
14 changes: 13 additions & 1 deletion templates/default/.github/rulesets/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,24 @@
{
"type": "required_status_checks",
"parameters": {
"strict_required_status_checks_policy": true,
"strict_required_status_checks_policy": false,
"do_not_enforce_on_create": false,
"required_status_checks": [
{ "context": "ci / flake-check", "integration_id": 15368 }
]
}
},
{
"type": "merge_queue",
"parameters": {
"merge_method": "SQUASH",
"grouping_strategy": "ALLGREEN",
"max_entries_to_build": 5,
"min_entries_to_merge": 1,
"max_entries_to_merge": 5,
"min_entries_to_merge_wait_minutes": 0,
"check_response_timeout_minutes": 60
}
}
],
"bypass_actors": [
Expand Down