-
Notifications
You must be signed in to change notification settings - Fork 4.9k
feat(governance): add repository ruleset tools with multi-level scope challenge #2991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SamMorrowDrums
wants to merge
6
commits into
main
Choose a base branch
from
sammorrowdrums-governance-rulesets
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cf99bb6
feat(governance): add repository ruleset tools with multi-level scope…
SamMorrowDrums 4443619
fix(governance): complete ruleset routing and validation
SamMorrowDrums 0ebe8d7
fix(governance): escape ruleset branch path
SamMorrowDrums 4ddbb27
fix(governance): decode enterprise ruleset lists
SamMorrowDrums 1c2d856
fix(governance): reject unknown ruleset create fields
SamMorrowDrums b89714a
fix(governance): require explicit ruleset bypass mode
SamMorrowDrums File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
135 changes: 135 additions & 0 deletions
135
pkg/github/__toolsnaps__/create_repository_ruleset.snap
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| { | ||
| "annotations": { | ||
| "idempotentHint": false, | ||
| "readOnlyHint": false, | ||
| "title": "Create repository ruleset" | ||
| }, | ||
| "description": "Create a new ruleset at the repository, organization, or enterprise level", | ||
| "inputSchema": { | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "bypass_actors": { | ||
| "description": "The actors that can bypass the rules in this ruleset", | ||
| "items": { | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "actor_id": { | ||
| "description": "The ID of the actor that can bypass a ruleset", | ||
| "type": "number" | ||
| }, | ||
| "actor_type": { | ||
| "description": "The type of actor that can bypass a ruleset. 'EnterpriseOwner' and 'EnterpriseRole' are only valid for 'enterprise' level rulesets.", | ||
| "enum": [ | ||
| "Integration", | ||
| "OrganizationAdmin", | ||
| "RepositoryRole", | ||
| "Team", | ||
| "DeployKey", | ||
| "User", | ||
| "EnterpriseOwner", | ||
| "EnterpriseRole" | ||
| ], | ||
| "type": "string" | ||
| }, | ||
| "bypass_mode": { | ||
| "description": "When the specified actor can bypass the ruleset. 'pull_request' only applies to branch rulesets and is not valid for the 'DeployKey' actor type. 'exempt' means rules are not run for that actor and no bypass audit entry is created.", | ||
| "enum": [ | ||
| "always", | ||
| "pull_request", | ||
| "exempt" | ||
| ], | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "required": [ | ||
| "actor_type", | ||
| "bypass_mode" | ||
| ], | ||
| "type": "object" | ||
| }, | ||
| "type": "array" | ||
| }, | ||
| "conditions": { | ||
| "description": "Conditions for when this ruleset applies, e.g. {\"ref_name\": {\"include\": [\"refs/heads/main\"], \"exclude\": []}}", | ||
| "type": "object" | ||
| }, | ||
| "enforcement": { | ||
| "description": "The enforcement level of the ruleset. 'evaluate' allows admins to test rules before enforcing them", | ||
| "enum": [ | ||
| "disabled", | ||
| "active", | ||
| "evaluate" | ||
| ], | ||
| "type": "string" | ||
| }, | ||
| "enterprise": { | ||
| "description": "Enterprise slug. Required when level is 'enterprise'.", | ||
| "type": "string" | ||
| }, | ||
| "level": { | ||
| "description": "The level at which the ruleset is configured:\n- 'repository': A ruleset on a single repository (requires 'owner' and 'repo').\n- 'organization': A ruleset covering repositories in an organization (requires 'org').\n- 'enterprise': A ruleset covering repositories across an enterprise (requires 'enterprise').", | ||
| "enum": [ | ||
| "repository", | ||
| "organization", | ||
| "enterprise" | ||
| ], | ||
| "type": "string" | ||
| }, | ||
| "name": { | ||
| "description": "The name of the ruleset", | ||
| "type": "string" | ||
| }, | ||
| "org": { | ||
| "description": "Organization name. Required when level is 'organization'.", | ||
| "type": "string" | ||
| }, | ||
| "owner": { | ||
| "description": "Repository owner. Required when level is 'repository'.", | ||
| "type": "string" | ||
| }, | ||
| "repo": { | ||
| "description": "Repository name. Required when level is 'repository'.", | ||
| "type": "string" | ||
| }, | ||
| "rules": { | ||
| "description": "An array of rules within the ruleset. Each rule is an object with a 'type' (e.g. 'creation', 'deletion', 'non_fast_forward', 'required_signatures', 'pull_request', 'required_status_checks') and, for rules that need configuration, a 'parameters' object", | ||
| "items": { | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "parameters": { | ||
| "description": "Parameters for rule types that require additional configuration", | ||
| "type": "object" | ||
| }, | ||
| "type": { | ||
| "description": "The type of rule, e.g. 'creation', 'deletion', 'non_fast_forward', 'required_signatures', 'pull_request', 'required_status_checks'", | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "required": [ | ||
| "type" | ||
| ], | ||
| "type": "object" | ||
| }, | ||
| "type": "array" | ||
| }, | ||
| "target": { | ||
| "description": "The target of the ruleset. Defaults to 'branch'. 'repository' is only valid for 'organization' and 'enterprise' level rulesets.", | ||
| "enum": [ | ||
| "branch", | ||
| "tag", | ||
| "push", | ||
| "repository" | ||
| ], | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "required": [ | ||
| "level", | ||
| "name", | ||
| "enforcement", | ||
| "rules" | ||
| ], | ||
| "type": "object" | ||
| }, | ||
| "name": "create_repository_ruleset" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.