Skip to content

Commit 72a5ce7

Browse files
Add support for rulesets and custom properties.
Add comprehensive tests for GitHub repository ruleset functionalities - Implement tests for GetRepositoryRuleset, ListRepositoryRulesets, GetRepositoryRulesForBranch, GetOrganizationRepositoryRuleset, ListOrganizationRepositoryRulesets, ListRepositoryRuleSuites, and GetRepositoryRuleSuite functions. - Validate tool definitions, input schemas, and required parameters. - Mock GitHub API responses for various scenarios including successful fetches and error cases. - Ensure proper error handling and assertions for expected outcomes in tests.
1 parent 33a63a0 commit 72a5ce7

13 files changed

+2272
-111
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ The following sets of tools are available (all are on by default):
458458

459459
- **list_discussion_categories** - List discussion categories
460460
- `owner`: Repository owner (string, required)
461-
- `repo`: Repository name. If not provided, discussion categories will be queried at the organisation level. (string, optional)
461+
- `repo`: Repository name (string, required)
462462

463463
- **list_discussions** - List discussions
464464
- `after`: Cursor for pagination. Use the endCursor from the previous page's PageInfo for GraphQL APIs. (string, optional)
@@ -632,6 +632,15 @@ The following sets of tools are available (all are on by default):
632632

633633
<summary>Organizations</summary>
634634

635+
- **get_organization_repository_ruleset** - Get organization repository ruleset
636+
- `org`: Organization name (string, required)
637+
- `rulesetId`: Ruleset ID (number, required)
638+
639+
- **list_organization_repository_rulesets** - List organization repository rulesets
640+
- `org`: Organization name (string, required)
641+
- `page`: Page number for pagination (min 1) (number, optional)
642+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
643+
635644
- **search_orgs** - Search organizations
636645
- `order`: Sort order (string, optional)
637646
- `page`: Page number for pagination (min 1) (number, optional)
@@ -829,6 +838,19 @@ The following sets of tools are available (all are on by default):
829838
- `repo`: Repository name (string, required)
830839
- `sha`: Accepts optional commit SHA. If specified, it will be used instead of ref (string, optional)
831840

841+
- **get_repository_rules_for_branch** - Get rules for branch
842+
- `branch`: Branch name (string, required)
843+
- `owner`: Repository owner (string, required)
844+
- `page`: Page number for pagination (min 1) (number, optional)
845+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
846+
- `repo`: Repository name (string, required)
847+
848+
- **get_repository_ruleset** - Get repository ruleset
849+
- `includesParents`: Include rulesets configured at higher levels that also apply (boolean, optional)
850+
- `owner`: Repository owner (string, required)
851+
- `repo`: Repository name (string, required)
852+
- `rulesetId`: Ruleset ID (number, required)
853+
832854
- **get_tag** - Get tag details
833855
- `owner`: Repository owner (string, required)
834856
- `repo`: Repository name (string, required)
@@ -848,6 +870,11 @@ The following sets of tools are available (all are on by default):
848870
- `repo`: Repository name (string, required)
849871
- `sha`: Commit SHA, branch or tag name to list commits of. If not provided, uses the default branch of the repository. If a commit SHA is provided, will list commits up to that SHA. (string, optional)
850872

873+
- **list_repository_rulesets** - List repository rulesets
874+
- `includesParents`: Include rulesets configured at higher levels that also apply (boolean, optional)
875+
- `owner`: Repository owner (string, required)
876+
- `repo`: Repository name (string, required)
877+
851878
- **list_tags** - List tags
852879
- `owner`: Repository owner (string, required)
853880
- `page`: Page number for pagination (min 1) (number, optional)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"annotations": {
3+
"title": "Get organization repository ruleset",
4+
"readOnlyHint": true
5+
},
6+
"description": "Get details of a specific organization repository ruleset",
7+
"inputSchema": {
8+
"properties": {
9+
"org": {
10+
"description": "Organization name",
11+
"type": "string"
12+
},
13+
"rulesetId": {
14+
"description": "Ruleset ID",
15+
"type": "number"
16+
}
17+
},
18+
"required": [
19+
"org",
20+
"rulesetId"
21+
],
22+
"type": "object"
23+
},
24+
"name": "get_organization_repository_ruleset"
25+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"annotations": {
3+
"title": "Get repository rule suite",
4+
"readOnlyHint": true
5+
},
6+
"description": "Get details of a specific repository rule suite",
7+
"inputSchema": {
8+
"properties": {
9+
"owner": {
10+
"description": "Repository owner",
11+
"type": "string"
12+
},
13+
"repo": {
14+
"description": "Repository name",
15+
"type": "string"
16+
},
17+
"ruleSuiteId": {
18+
"description": "Rule suite ID",
19+
"type": "number"
20+
}
21+
},
22+
"required": [
23+
"owner",
24+
"repo",
25+
"ruleSuiteId"
26+
],
27+
"type": "object"
28+
},
29+
"name": "get_repository_rule_suite"
30+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"annotations": {
3+
"title": "Get rules for branch",
4+
"readOnlyHint": true
5+
},
6+
"description": "Get all repository rules that apply to a specific branch",
7+
"inputSchema": {
8+
"properties": {
9+
"branch": {
10+
"description": "Branch name",
11+
"type": "string"
12+
},
13+
"owner": {
14+
"description": "Repository owner",
15+
"type": "string"
16+
},
17+
"page": {
18+
"description": "Page number for pagination (min 1)",
19+
"minimum": 1,
20+
"type": "number"
21+
},
22+
"perPage": {
23+
"description": "Results per page for pagination (min 1, max 100)",
24+
"maximum": 100,
25+
"minimum": 1,
26+
"type": "number"
27+
},
28+
"repo": {
29+
"description": "Repository name",
30+
"type": "string"
31+
}
32+
},
33+
"required": [
34+
"owner",
35+
"repo",
36+
"branch"
37+
],
38+
"type": "object"
39+
},
40+
"name": "get_repository_rules_for_branch"
41+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"annotations": {
3+
"title": "Get repository ruleset",
4+
"readOnlyHint": true
5+
},
6+
"description": "Get details of a specific repository ruleset",
7+
"inputSchema": {
8+
"properties": {
9+
"includesParents": {
10+
"description": "Include rulesets configured at higher levels that also apply",
11+
"type": "boolean"
12+
},
13+
"owner": {
14+
"description": "Repository owner",
15+
"type": "string"
16+
},
17+
"repo": {
18+
"description": "Repository name",
19+
"type": "string"
20+
},
21+
"rulesetId": {
22+
"description": "Ruleset ID",
23+
"type": "number"
24+
}
25+
},
26+
"required": [
27+
"owner",
28+
"repo",
29+
"rulesetId"
30+
],
31+
"type": "object"
32+
},
33+
"name": "get_repository_ruleset"
34+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"annotations": {
3+
"title": "List organization repository rulesets",
4+
"readOnlyHint": true
5+
},
6+
"description": "List all organization repository rulesets",
7+
"inputSchema": {
8+
"properties": {
9+
"org": {
10+
"description": "Organization name",
11+
"type": "string"
12+
},
13+
"page": {
14+
"description": "Page number for pagination (min 1)",
15+
"minimum": 1,
16+
"type": "number"
17+
},
18+
"perPage": {
19+
"description": "Results per page for pagination (min 1, max 100)",
20+
"maximum": 100,
21+
"minimum": 1,
22+
"type": "number"
23+
}
24+
},
25+
"required": [
26+
"org"
27+
],
28+
"type": "object"
29+
},
30+
"name": "list_organization_repository_rulesets"
31+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"annotations": {
3+
"title": "List repository rule suites",
4+
"readOnlyHint": true
5+
},
6+
"description": "List rule suites for a repository",
7+
"inputSchema": {
8+
"properties": {
9+
"actorName": {
10+
"description": "The handle for the GitHub user account to filter on",
11+
"type": "string"
12+
},
13+
"owner": {
14+
"description": "Repository owner",
15+
"type": "string"
16+
},
17+
"page": {
18+
"description": "Page number for pagination (min 1)",
19+
"minimum": 1,
20+
"type": "number"
21+
},
22+
"perPage": {
23+
"description": "Results per page for pagination (min 1, max 100)",
24+
"maximum": 100,
25+
"minimum": 1,
26+
"type": "number"
27+
},
28+
"ref": {
29+
"description": "The name of the ref (branch, tag, etc.) to filter rule suites by",
30+
"type": "string"
31+
},
32+
"repo": {
33+
"description": "Repository name",
34+
"type": "string"
35+
},
36+
"ruleSuiteResult": {
37+
"description": "The rule suite result to filter by. Options: pass, fail, bypass",
38+
"type": "string"
39+
},
40+
"timePeriod": {
41+
"description": "The time period to filter by. Options: hour, day, week, month",
42+
"type": "string"
43+
}
44+
},
45+
"required": [
46+
"owner",
47+
"repo"
48+
],
49+
"type": "object"
50+
},
51+
"name": "list_repository_rule_suites"
52+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"annotations": {
3+
"title": "List repository rulesets",
4+
"readOnlyHint": true
5+
},
6+
"description": "List all repository rulesets",
7+
"inputSchema": {
8+
"properties": {
9+
"includesParents": {
10+
"description": "Include rulesets configured at higher levels that also apply",
11+
"type": "boolean"
12+
},
13+
"owner": {
14+
"description": "Repository owner",
15+
"type": "string"
16+
},
17+
"repo": {
18+
"description": "Repository name",
19+
"type": "string"
20+
}
21+
},
22+
"required": [
23+
"owner",
24+
"repo"
25+
],
26+
"type": "object"
27+
},
28+
"name": "list_repository_rulesets"
29+
}

0 commit comments

Comments
 (0)