[build] dynamically add and remove rulesets for release#17439
Conversation
Review Summary by QodoDynamically manage rulesets for release using JSON configuration
WalkthroughsDescription• Replace hardcoded ruleset IDs with dynamic JSON-based configuration • Create and delete rulesets programmatically during release workflow • Add CI success verification job to validate all required checks • Improve release process robustness and maintainability Diagramflowchart LR
A["Ruleset JSON Files"] -->|"Define rules"| B["restrict-trunk.yml"]
B -->|"Create on restrict"| C["GitHub Rulesets API"]
B -->|"Delete on unrestrict"| C
D["CI Workflow"] -->|"Add verification"| E["CI Success Job"]
E -->|"Validates all checks"| F["Release Ready"]
File Changes1. .github/rulesets/release-require-passing.json
|
Code Review by Qodo
1.
|
There was a problem hiding this comment.
Pull request overview
This PR replaces hard-coded GitHub Ruleset IDs used to lock/unlock trunk during release with committed JSON ruleset definitions that are created/deleted dynamically, and adds a dedicated “CI Success” check to support a required-status-check rule during release.
Changes:
- Update
restrict-trunk.ymlto checkout committed ruleset JSON and create/delete rulesets viagh api. - Add a
CI Successjob toci.ymlthat aggregates results of the main CI jobs. - Add two committed release ruleset definitions (
Release: Restrict Trunk,Release: Require Passing).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/restrict-trunk.yml | Switches from updating fixed ruleset IDs to creating/deleting rulesets from committed JSON via GitHub API. |
| .github/workflows/ci.yml | Adds a terminal “CI Success” job intended to be used as a required status check during releases. |
| .github/rulesets/release-restrict-trunk.json | Defines the release-only ruleset to prevent non-fast-forward/deletion/updates to the default branch except for a bypass team. |
| .github/rulesets/release-require-passing.json | Defines the release-only ruleset requiring specific checks (including “CI Success”) before updates to the default branch. |
|
Persistent review updated to latest commit 236ef87 |
|
Persistent review updated to latest commit 68ca405 |
|
Persistent review updated to latest commit 3aea68b |
This reverts commit 68ca405.
|
Persistent review updated to latest commit 49ef327 |
|
Persistent review updated to latest commit ac25d48 |
|
Persistent review updated to latest commit 6b83248 |
💥 What does this PR do?
The rulesets we were using to lock trunk during release were deleted, demonstrating that relying on hard coded ids was brittle. This new process uses committed json files to dynamically create and delete rulesets during the release.
Also this fixes nightly
Implementation
Note that I'm not using pagination in gh api call because we won't have 30 rulesets and the code gets weird quickly.
🤖 AI assistance
🔄 Types of changes