You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fe0ece5
Browse filesBrowse the repository at this point in the historyBrowse files
committed
feat(governance): add repository ruleset tools with multi-level scope challenge
Reimplements the repository ruleset support from #821 (issue #820) onto the
current inventory-based tool architecture, consolidated into two level-aware
tools in a new non-default `governance` toolset.
- `repository_ruleset_read`: read rulesets, branch rules, and rule suites at
repository, organization, or enterprise level.
- `create_repository_ruleset`: create a ruleset at any of the three levels.
A `level` argument selects the scope, and a DynamicChallenge up-scopes the
required OAuth scope accordingly (repo -> read:org/admin:org ->
read:enterprise/admin:enterprise), so the default surface only asks for repo
scope. Ruleset creation round-trips the request through go-github's
RepositoryRuleset unmarshalling and rejects rule types, parameters, conditions,
or bypass-actor keys that are silently dropped, preventing typos from creating
a weaker-than-intended ruleset.
Co-authored-by: Patrick Knight <patrick-knight@github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1e886867-a922-419a-b02c-ac643716aea8
Copy file name to clipboardExpand all lines: README.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -586,6 +586,7 @@ The following sets of tools are available:
586
586
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="pkg/octicons/icons/comment-discussion-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="pkg/octicons/icons/comment-discussion-light.png"><imgsrc="pkg/octicons/icons/comment-discussion-light.png"width="20"height="20"alt="comment-discussion"></picture> |`discussions`| GitHub Discussions related tools |
587
587
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="pkg/octicons/icons/logo-gist-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="pkg/octicons/icons/logo-gist-light.png"><imgsrc="pkg/octicons/icons/logo-gist-light.png"width="20"height="20"alt="logo-gist"></picture> |`gists`| GitHub Gist related tools |
588
588
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="pkg/octicons/icons/git-branch-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="pkg/octicons/icons/git-branch-light.png"><imgsrc="pkg/octicons/icons/git-branch-light.png"width="20"height="20"alt="git-branch"></picture> |`git`| GitHub Git API related tools for low-level Git operations |
589
+
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="pkg/octicons/icons/law-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="pkg/octicons/icons/law-light.png"><imgsrc="pkg/octicons/icons/law-light.png"width="20"height="20"alt="law"></picture> |`governance`| Repository governance tools for managing rulesets at the repository, organization, and enterprise levels |
589
590
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="pkg/octicons/icons/issue-opened-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="pkg/octicons/icons/issue-opened-light.png"><imgsrc="pkg/octicons/icons/issue-opened-light.png"width="20"height="20"alt="issue-opened"></picture> |`issues`| GitHub Issues related tools |
590
591
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="pkg/octicons/icons/tag-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="pkg/octicons/icons/tag-light.png"><imgsrc="pkg/octicons/icons/tag-light.png"width="20"height="20"alt="tag"></picture> |`labels`| GitHub Labels related tools |
591
592
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="pkg/octicons/icons/bell-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="pkg/octicons/icons/bell-light.png"><imgsrc="pkg/octicons/icons/bell-light.png"width="20"height="20"alt="bell"></picture> |`notifications`| GitHub Notifications related tools |
@@ -872,6 +873,56 @@ The following sets of tools are available:
-`bypass_actors`: The actors that can bypass the rules in this ruleset (object[], optional)
881
+
-`conditions`: Conditions for when this ruleset applies, e.g. {"ref_name": {"include": ["refs/heads/main"], "exclude": []}} (object, optional)
882
+
-`enforcement`: The enforcement level of the ruleset. 'evaluate' allows admins to test rules before enforcing them (string, required)
883
+
-`enterprise`: Enterprise slug. Required when level is 'enterprise'. (string, optional)
884
+
-`level`: The level at which the ruleset is configured:
885
+
- 'repository': A ruleset on a single repository (requires 'owner' and 'repo').
886
+
- 'organization': A ruleset covering repositories in an organization (requires 'org').
887
+
- 'enterprise': A ruleset covering repositories across an enterprise (requires 'enterprise'). (string, required)
888
+
-`name`: The name of the ruleset (string, required)
889
+
-`org`: Organization name. Required when level is 'organization'. (string, optional)
890
+
-`owner`: Repository owner. Required when level is 'repository'. (string, optional)
891
+
-`repo`: Repository name. Required when level is 'repository'. (string, optional)
892
+
-`rules`: 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 (object[], required)
893
+
-`target`: The target of the ruleset. Defaults to 'branch'. 'repository' is only valid for 'organization' and 'enterprise' level rulesets. (string, optional)
-`actor_name`: The handle for the GitHub user account to filter rule suites on. Used by the 'list_rule_suites' method. (string, optional)
898
+
-`branch`: Branch name. Required for the 'get_rules_for_branch' method. (string, optional)
899
+
-`enterprise`: Enterprise slug. Required when level is 'enterprise'. (string, optional)
900
+
-`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)
901
+
-`level`: The level at which the ruleset is configured:
902
+
- 'repository': A ruleset on a single repository (requires 'owner' and 'repo').
903
+
- 'organization': A ruleset covering repositories in an organization (requires 'org').
904
+
- 'enterprise': A ruleset covering repositories across an enterprise (requires 'enterprise'). (string, required)
905
+
-`method`: Operation to perform:
906
+
- 'get': Get a specific ruleset by ID (requires 'ruleset_id'). Supported at every level.
907
+
- 'list': List all rulesets. Supported at every level.
908
+
- '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)
911
+
-`org`: Organization name. Required when level is 'organization'. (string, optional)
912
+
-`owner`: Repository owner. Required when level is 'repository'. (string, optional)
913
+
-`page`: Page number for pagination (min 1) (number, optional)
914
+
-`perPage`: Results per page for pagination (min 1, max 100) (number, optional)
915
+
-`ref`: The name of the ref (branch, tag, etc.) to filter rule suites by. Used by the 'list_rule_suites' method. (string, optional)
916
+
-`repo`: Repository name. Required when level is 'repository'. (string, optional)
917
+
-`rule_suite_id`: Rule suite ID. Required for the 'get_rule_suite' method. (number, optional)
918
+
-`rule_suite_result`: The rule suite result to filter by. Used by the 'list_rule_suites' method. (string, optional)
919
+
-`ruleset_id`: Ruleset ID. Required for the 'get' method. (number, optional)
920
+
-`time_period`: The time period to filter rule suites by. Used by the 'list_rule_suites' method. (string, optional)
Copy file name to clipboardExpand all lines: docs/remote-server.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,7 @@ Below is a table of available toolsets for the remote GitHub MCP Server. Each to
30
30
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="../pkg/octicons/icons/comment-discussion-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="../pkg/octicons/icons/comment-discussion-light.png"><imgsrc="../pkg/octicons/icons/comment-discussion-light.png"width="20"height="20"alt="comment-discussion"></picture><br>`discussions`| GitHub Discussions related tools |https://api.githubcopilot.com/mcp/x/discussions|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-discussions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdiscussions%22%7D)|[read-only](https://api.githubcopilot.com/mcp/x/discussions/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-discussions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdiscussions%2Freadonly%22%7D)|
31
31
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="../pkg/octicons/icons/logo-gist-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="../pkg/octicons/icons/logo-gist-light.png"><imgsrc="../pkg/octicons/icons/logo-gist-light.png"width="20"height="20"alt="logo-gist"></picture><br>`gists`| GitHub Gist related tools |https://api.githubcopilot.com/mcp/x/gists|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-gists&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgists%22%7D)|[read-only](https://api.githubcopilot.com/mcp/x/gists/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-gists&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgists%2Freadonly%22%7D)|
32
32
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="../pkg/octicons/icons/git-branch-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="../pkg/octicons/icons/git-branch-light.png"><imgsrc="../pkg/octicons/icons/git-branch-light.png"width="20"height="20"alt="git-branch"></picture><br>`git`| GitHub Git API related tools for low-level Git operations |https://api.githubcopilot.com/mcp/x/git|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-git&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgit%22%7D)|[read-only](https://api.githubcopilot.com/mcp/x/git/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-git&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgit%2Freadonly%22%7D)|
33
+
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="../pkg/octicons/icons/law-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="../pkg/octicons/icons/law-light.png"><imgsrc="../pkg/octicons/icons/law-light.png"width="20"height="20"alt="law"></picture><br>`governance`| Repository governance tools for managing rulesets at the repository, organization, and enterprise levels |https://api.githubcopilot.com/mcp/x/governance|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-governance&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgovernance%22%7D)|[read-only](https://api.githubcopilot.com/mcp/x/governance/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-governance&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgovernance%2Freadonly%22%7D)|
33
34
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="../pkg/octicons/icons/issue-opened-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="../pkg/octicons/icons/issue-opened-light.png"><imgsrc="../pkg/octicons/icons/issue-opened-light.png"width="20"height="20"alt="issue-opened"></picture><br>`issues`| GitHub Issues related tools |https://api.githubcopilot.com/mcp/x/issues|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%22%7D)|[read-only](https://api.githubcopilot.com/mcp/x/issues/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%2Freadonly%22%7D)|
34
35
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="../pkg/octicons/icons/tag-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="../pkg/octicons/icons/tag-light.png"><imgsrc="../pkg/octicons/icons/tag-light.png"width="20"height="20"alt="tag"></picture><br>`labels`| GitHub Labels related tools |https://api.githubcopilot.com/mcp/x/labels|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-labels&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Flabels%22%7D)|[read-only](https://api.githubcopilot.com/mcp/x/labels/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-labels&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Flabels%2Freadonly%22%7D)|
35
36
| <picture><sourcemedia="(prefers-color-scheme: dark)"srcset="../pkg/octicons/icons/bell-dark.png"><sourcemedia="(prefers-color-scheme: light)"srcset="../pkg/octicons/icons/bell-light.png"><imgsrc="../pkg/octicons/icons/bell-light.png"width="20"height="20"alt="bell"></picture><br>`notifications`| GitHub Notifications related tools |https://api.githubcopilot.com/mcp/x/notifications|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-notifications&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fnotifications%22%7D)|[read-only](https://api.githubcopilot.com/mcp/x/notifications/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-notifications&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fnotifications%2Freadonly%22%7D)|
"description": "Create a new ruleset at the repository, organization, or enterprise level",
8
+
"inputSchema": {
9
+
"properties": {
10
+
"bypass_actors": {
11
+
"description": "The actors that can bypass the rules in this ruleset",
12
+
"items": {
13
+
"properties": {
14
+
"actor_id": {
15
+
"description": "The ID of the actor that can bypass a ruleset",
16
+
"type": "number"
17
+
},
18
+
"actor_type": {
19
+
"description": "The type of actor that can bypass a ruleset. 'EnterpriseOwner' and 'EnterpriseRole' are only valid for 'enterprise' level rulesets.",
20
+
"enum": [
21
+
"Integration",
22
+
"OrganizationAdmin",
23
+
"RepositoryRole",
24
+
"Team",
25
+
"DeployKey",
26
+
"User",
27
+
"EnterpriseOwner",
28
+
"EnterpriseRole"
29
+
],
30
+
"type": "string"
31
+
},
32
+
"bypass_mode": {
33
+
"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.",
34
+
"enum": [
35
+
"always",
36
+
"pull_request",
37
+
"exempt"
38
+
],
39
+
"type": "string"
40
+
}
41
+
},
42
+
"type": "object"
43
+
},
44
+
"type": "array"
45
+
},
46
+
"conditions": {
47
+
"description": "Conditions for when this ruleset applies, e.g. {\"ref_name\": {\"include\": [\"refs/heads/main\"], \"exclude\": []}}",
48
+
"type": "object"
49
+
},
50
+
"enforcement": {
51
+
"description": "The enforcement level of the ruleset. 'evaluate' allows admins to test rules before enforcing them",
52
+
"enum": [
53
+
"disabled",
54
+
"active",
55
+
"evaluate"
56
+
],
57
+
"type": "string"
58
+
},
59
+
"enterprise": {
60
+
"description": "Enterprise slug. Required when level is 'enterprise'.",
61
+
"type": "string"
62
+
},
63
+
"level": {
64
+
"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').",
65
+
"enum": [
66
+
"repository",
67
+
"organization",
68
+
"enterprise"
69
+
],
70
+
"type": "string"
71
+
},
72
+
"name": {
73
+
"description": "The name of the ruleset",
74
+
"type": "string"
75
+
},
76
+
"org": {
77
+
"description": "Organization name. Required when level is 'organization'.",
78
+
"type": "string"
79
+
},
80
+
"owner": {
81
+
"description": "Repository owner. Required when level is 'repository'.",
82
+
"type": "string"
83
+
},
84
+
"repo": {
85
+
"description": "Repository name. Required when level is 'repository'.",
86
+
"type": "string"
87
+
},
88
+
"rules": {
89
+
"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",
90
+
"items": {
91
+
"properties": {
92
+
"parameters": {
93
+
"description": "Parameters for rule types that require additional configuration",
94
+
"type": "object"
95
+
},
96
+
"type": {
97
+
"description": "The type of rule, e.g. 'creation', 'deletion', 'non_fast_forward', 'required_signatures', 'pull_request', 'required_status_checks'",
98
+
"type": "string"
99
+
}
100
+
},
101
+
"required": [
102
+
"type"
103
+
],
104
+
"type": "object"
105
+
},
106
+
"type": "array"
107
+
},
108
+
"target": {
109
+
"description": "The target of the ruleset. Defaults to 'branch'. 'repository' is only valid for 'organization' and 'enterprise' level rulesets.",
0 commit comments