Open
Conversation
…s in settings.json
…erty in settings.json
…borg levels - Introduced `repos.json` schema for repository-level safe-settings overrides. - Updated `settings.json` schema to include additional properties for org-level configurations. - Created `suborgs.json` schema for suborg-level safe-settings configuration. - Enhanced the build script to dereference all schemas and handle errors during the process.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves safe-settings’ config validation and branch protection syncing by introducing JSON schemas (and a dereferencing build step tied to the GitHub REST API spec), updating REST API versioning references, and enhancing branch protection preservation behavior/tests.
Changes:
- Added new JSON Schemas for org/suborg/repo config files and committed dereferenced schema outputs.
- Updated
script/build-schemato resolve GitHub REST API spec$refs reliably before dereferencing. - Enhanced branch protection syncing/tests to preserve existing GitHub settings (e.g.,
enforce_admins,restrictions) when omitted from config.
Reviewed changes
Copilot reviewed 25 out of 28 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
lib/plugins/branches.js |
Preserves existing branch protection fields and normalizes restrictions/status checks before updates. |
test/unit/lib/plugins/branches.test.js |
Adds/adjusts tests for preserving enforce_admins/restrictions and normalizing restriction arrays. |
script/build-schema |
Fetches GitHub REST API spec URL from schema sources and pre-dereferences it for stable dereferencing. |
schema/settings.json |
Refactors schema into $defs and updates GitHub REST API spec references/version. |
schema/suborgs.json |
Introduces suborg-level schema referencing GitHub REST API spec shapes. |
schema/repos.json |
Introduces repo-level override schema referencing GitHub REST API spec shapes. |
schema/dereferenced/settings.json |
Updated generated dereferenced org-level schema output. |
schema/dereferenced/repos.json |
Added generated dereferenced repo-level schema output. |
lib/settings.js |
Ensures org-level rulesets are applied first when syncing selected repos. |
lib/plugins/custom_properties.js |
Avoids crashes by filtering null property names during normalization. |
lib/plugins/rulesets.js |
Updates API version header and adjusts override metadata. |
test/unit/lib/plugins/rulesets.test.js |
Updates expected API version header. |
lib/plugins/variables.js / lib/plugins/autolinks.js / lib/plugins/collaborators.js |
Updates REST API doc links to the newer API version. |
index.js |
Updates REST API version headers for rename-related content operations. |
docs/** |
Updates documentation links to the newer API version; sample deployment validator script made safer via optional chaining. |
app.yml |
Updates documentation link for Actions variables permission. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #465
Update schemas to target latest GitHub API
feat(schema): add bypass mode for reviewers in suborgs schema
Introduced a new "mode" property in the suborgs schema to specify the bypass mode for reviewers, with options "ALWAYS" and "EXEMPT".
fix(build-schema): enhance schema dereferencing with GitHub API spec
test(branches): preserve existing branch protection settings
enforce_adminsandrestrictions, are preserved when updating branch protection configurations.