Skip to content

Commit 1b9a80e

Browse files
fix(governance): complete ruleset routing and validation
Add organization rule-suite routing and current filters, harden schema validation, and keep scope metadata usable for fixed-scope tokens and library callers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 9bf930e commit 1b9a80e

6 files changed

Lines changed: 228 additions & 122 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ The following sets of tools are available:
897897
- `actor_name`: The handle for the GitHub user account to filter rule suites on. Used by the 'list_rule_suites' method. (string, optional)
898898
- `branch`: Branch name. Required for the 'get_rules_for_branch' method. (string, optional)
899899
- `enterprise`: Enterprise slug. Required when level is 'enterprise'. (string, optional)
900+
- `evaluate_status`: Filter rule suites by ruleset evaluation mode. Used by the 'list_rule_suites' method. (string, optional)
900901
- `includes_parents`: Include rulesets configured at higher levels that also apply. Defaults to true. Used by the 'get' and 'list' methods at the repository level. (boolean, optional)
901902
- `level`: The level at which the ruleset is configured:
902903
- 'repository': A ruleset on a single repository (requires 'owner' and 'repo').
@@ -906,14 +907,15 @@ The following sets of tools are available:
906907
- 'get': Get a specific ruleset by ID (requires 'ruleset_id'). Supported at every level.
907908
- 'list': List all rulesets. Supported at every level.
908909
- 'get_rules_for_branch': Get all rules that apply to a branch (requires 'branch'). Repository level only.
909-
- 'list_rule_suites': List rule suites, the evaluations of rules against pushes. Repository level only.
910-
- 'get_rule_suite': Get a specific rule suite by ID (requires 'rule_suite_id'). Repository level only. (string, required)
910+
- 'list_rule_suites': List rule suites, the evaluations of rules against pushes. Repository and organization levels only.
911+
- 'get_rule_suite': Get a specific rule suite by ID (requires 'rule_suite_id'). Repository and organization levels only. (string, required)
911912
- `org`: Organization name. Required when level is 'organization'. (string, optional)
912913
- `owner`: Repository owner. Required when level is 'repository'. (string, optional)
913914
- `page`: Page number for pagination (min 1) (number, optional)
914915
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
915916
- `ref`: The name of the ref (branch, tag, etc.) to filter rule suites by. Used by the 'list_rule_suites' method. (string, optional)
916917
- `repo`: Repository name. Required when level is 'repository'. (string, optional)
918+
- `repository_name`: Repository name to filter rule suites by. Used by the 'list_rule_suites' method at the organization level. (string, optional)
917919
- `rule_suite_id`: Rule suite ID. Required for the 'get_rule_suite' method. (number, optional)
918920
- `rule_suite_result`: The rule suite result to filter by. Used by the 'list_rule_suites' method. (string, optional)
919921
- `ruleset_id`: Ruleset ID. Required for the 'get' method. (number, optional)

pkg/github/__toolsnaps__/create_repository_ruleset.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"bypass_actors": {
1111
"description": "The actors that can bypass the rules in this ruleset",
1212
"items": {
13+
"additionalProperties": false,
1314
"properties": {
1415
"actor_id": {
1516
"description": "The ID of the actor that can bypass a ruleset",
@@ -39,6 +40,9 @@
3940
"type": "string"
4041
}
4142
},
43+
"required": [
44+
"actor_type"
45+
],
4246
"type": "object"
4347
},
4448
"type": "array"
@@ -88,6 +92,7 @@
8892
"rules": {
8993
"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",
9094
"items": {
95+
"additionalProperties": false,
9196
"properties": {
9297
"parameters": {
9398
"description": "Parameters for rule types that require additional configuration",

pkg/github/__toolsnaps__/repository_ruleset_read.snap

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"readOnlyHint": true,
55
"title": "Read repository rulesets"
66
},
7-
"description": "Read rulesets and rule suites at the repository, organization, or enterprise level. Select the level with the 'level' parameter and the operation with the 'method' parameter.",
7+
"description": "Read rulesets at the repository, organization, or enterprise level, and rule suites at the repository or organization level. Select the level with the 'level' parameter and the operation with the 'method' parameter.",
88
"inputSchema": {
99
"properties": {
1010
"actor_name": {
@@ -19,6 +19,15 @@
1919
"description": "Enterprise slug. Required when level is 'enterprise'.",
2020
"type": "string"
2121
},
22+
"evaluate_status": {
23+
"description": "Filter rule suites by ruleset evaluation mode. Used by the 'list_rule_suites' method.",
24+
"enum": [
25+
"all",
26+
"active",
27+
"evaluate"
28+
],
29+
"type": "string"
30+
},
2231
"includes_parents": {
2332
"description": "Include rulesets configured at higher levels that also apply. Defaults to true. Used by the 'get' and 'list' methods at the repository level.",
2433
"type": "boolean"
@@ -33,7 +42,7 @@
3342
"type": "string"
3443
},
3544
"method": {
36-
"description": "Operation to perform:\n- 'get': Get a specific ruleset by ID (requires 'ruleset_id'). Supported at every level.\n- 'list': List all rulesets. Supported at every level.\n- 'get_rules_for_branch': Get all rules that apply to a branch (requires 'branch'). Repository level only.\n- 'list_rule_suites': List rule suites, the evaluations of rules against pushes. Repository level only.\n- 'get_rule_suite': Get a specific rule suite by ID (requires 'rule_suite_id'). Repository level only.",
45+
"description": "Operation to perform:\n- 'get': Get a specific ruleset by ID (requires 'ruleset_id'). Supported at every level.\n- 'list': List all rulesets. Supported at every level.\n- 'get_rules_for_branch': Get all rules that apply to a branch (requires 'branch'). Repository level only.\n- 'list_rule_suites': List rule suites, the evaluations of rules against pushes. Repository and organization levels only.\n- 'get_rule_suite': Get a specific rule suite by ID (requires 'rule_suite_id'). Repository and organization levels only.",
3746
"enum": [
3847
"get",
3948
"list",
@@ -70,6 +79,10 @@
7079
"description": "Repository name. Required when level is 'repository'.",
7180
"type": "string"
7281
},
82+
"repository_name": {
83+
"description": "Repository name to filter rule suites by. Used by the 'list_rule_suites' method at the organization level.",
84+
"type": "string"
85+
},
7386
"rule_suite_id": {
7487
"description": "Rule suite ID. Required for the 'get_rule_suite' method.",
7588
"type": "number"

0 commit comments

Comments
 (0)