diff --git a/documentation/docs/ci.md b/documentation/docs/ci.md index e2fb878..97d8448 100644 --- a/documentation/docs/ci.md +++ b/documentation/docs/ci.md @@ -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/ -F allow_auto_merge=true -F delete_branch_on_merge=true`). The status check is named ` / `. Keep the caller job id `ci` in every repo so one ruleset fits all of them. @@ -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": [ @@ -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//rulesets --input .github/rulesets/default.json` (or `PUT .../rulesets/` to replace an existing one). Org-wide: diff --git a/templates/default/.github/rulesets/default.json b/templates/default/.github/rulesets/default.json index 44e36da..9224471 100644 --- a/templates/default/.github/rulesets/default.json +++ b/templates/default/.github/rulesets/default.json @@ -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": [