Skip to content

Commit 655d301

Browse files
committed
lint, docs
1 parent 34465bd commit 655d301

2 files changed

Lines changed: 76 additions & 48 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,13 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
610610
- `owner`: Repository owner (string, required)
611611
- `repo`: Repository name (string, required)
612612

613+
- **add_sub_issue** - Add sub-issue
614+
- `issue_number`: The number of the parent issue (number, required)
615+
- `owner`: Repository owner (string, required)
616+
- `replace_parent`: When true, replaces the sub-issue's current parent issue (boolean, optional)
617+
- `repo`: Repository name (string, required)
618+
- `sub_issue_id`: The ID of the sub-issue to add. Note: This is NOT the same as the issue number. (number, required)
619+
613620
- **assign_copilot_to_issue** - Assign Copilot to issue
614621
- `issueNumber`: Issue number (number, required)
615622
- `owner`: Repository owner (string, required)
@@ -647,6 +654,27 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
647654
- `sort`: Sort order (string, optional)
648655
- `state`: Filter by state (string, optional)
649656

657+
- **list_sub_issues** - List sub-issues
658+
- `issue_number`: Issue number (number, required)
659+
- `owner`: Repository owner (string, required)
660+
- `page`: Page number for pagination (default: 1) (number, optional)
661+
- `per_page`: Number of results per page (max 100, default: 30) (number, optional)
662+
- `repo`: Repository name (string, required)
663+
664+
- **remove_sub_issue** - Remove sub-issue
665+
- `issue_number`: The number of the parent issue (number, required)
666+
- `owner`: Repository owner (string, required)
667+
- `repo`: Repository name (string, required)
668+
- `sub_issue_id`: The ID of the sub-issue to remove. Note: This is NOT the same as the issue number. (number, required)
669+
670+
- **reprioritize_sub_issue** - Reprioritize sub-issue
671+
- `after_id`: The ID of the sub-issue to be prioritized after (either after_id OR before_id should be specified) (number, optional)
672+
- `before_id`: The ID of the sub-issue to be prioritized before (either after_id OR before_id should be specified) (number, optional)
673+
- `issue_number`: The number of the parent issue (number, required)
674+
- `owner`: Repository owner (string, required)
675+
- `repo`: Repository name (string, required)
676+
- `sub_issue_id`: The ID of the sub-issue to reprioritize. Note: This is NOT the same as the issue number. (number, required)
677+
650678
- **search_issues** - Search issues
651679
- `order`: Sort order (string, optional)
652680
- `owner`: Optional repository owner. If provided with repo, only notifications for this repository are listed. (string, optional)

pkg/github/issues.go

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func AddSubIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
210210
}
211211

212212
subIssueRequest := github.SubIssueRequest{
213-
SubIssueID: int64(subIssueID),
213+
SubIssueID: int64(subIssueID),
214214
ReplaceParent: ToBoolPtr(replaceParent),
215215
}
216216

@@ -223,7 +223,7 @@ func AddSubIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
223223
), nil
224224
}
225225

226-
defer func() { _ = resp.Body.Close() }()
226+
defer func() { _ = resp.Body.Close() }()
227227

228228
if resp.StatusCode != http.StatusCreated {
229229
body, err := io.ReadAll(resp.Body)
@@ -297,11 +297,11 @@ func ListSubIssues(getClient GetClientFn, t translations.TranslationHelperFunc)
297297
}
298298

299299
opts := &github.IssueListOptions{
300-
ListOptions: github.ListOptions{
301-
Page: page,
302-
PerPage: perPage,
303-
},
304-
}
300+
ListOptions: github.ListOptions{
301+
Page: page,
302+
PerPage: perPage,
303+
},
304+
}
305305

306306
subIssues, resp, err := client.SubIssue.ListByIssue(ctx, owner, repo, int64(issueNumber), opts)
307307
if err != nil {
@@ -312,7 +312,7 @@ func ListSubIssues(getClient GetClientFn, t translations.TranslationHelperFunc)
312312
), nil
313313
}
314314

315-
defer func() { _ = resp.Body.Close() }()
315+
defer func() { _ = resp.Body.Close() }()
316316

317317
if resp.StatusCode != http.StatusOK {
318318
body, err := io.ReadAll(resp.Body)
@@ -329,7 +329,7 @@ func ListSubIssues(getClient GetClientFn, t translations.TranslationHelperFunc)
329329

330330
return mcp.NewToolResultText(string(r)), nil
331331
}
332-
332+
333333
}
334334

335335
// RemoveSubIssue creates a tool to remove a sub-issue from a parent issue.
@@ -503,48 +503,48 @@ func ReprioritizeSubIssue(getClient GetClientFn, t translations.TranslationHelpe
503503
}
504504

505505
client, err := getClient(ctx)
506-
if err != nil {
507-
return nil, fmt.Errorf("failed to get GitHub client: %w", err)
508-
}
506+
if err != nil {
507+
return nil, fmt.Errorf("failed to get GitHub client: %w", err)
508+
}
509509

510-
subIssueRequest := github.SubIssueRequest{
511-
SubIssueID: int64(subIssueID),
512-
}
510+
subIssueRequest := github.SubIssueRequest{
511+
SubIssueID: int64(subIssueID),
512+
}
513513

514514
if afterID != 0 {
515-
afterIDInt64 := int64(afterID)
516-
subIssueRequest.AfterID = &afterIDInt64
517-
}
518-
if beforeID != 0 {
519-
beforeIDInt64 := int64(beforeID)
520-
subIssueRequest.BeforeID = &beforeIDInt64
521-
}
522-
523-
subIssue, resp, err := client.SubIssue.Reprioritize(ctx, owner, repo, int64(issueNumber), subIssueRequest)
524-
if err != nil {
525-
return ghErrors.NewGitHubAPIErrorResponse(ctx,
526-
"failed to reprioritize sub-issue",
527-
resp,
528-
err,
529-
), nil
530-
}
531-
532-
defer func() { _ = resp.Body.Close() }()
533-
534-
if resp.StatusCode != http.StatusOK {
535-
body, err := io.ReadAll(resp.Body)
536-
if err != nil {
537-
return nil, fmt.Errorf("failed to read response body: %w", err)
538-
}
539-
return mcp.NewToolResultError(fmt.Sprintf("failed to reprioritize sub-issue: %s", string(body))), nil
540-
}
541-
542-
r, err := json.Marshal(subIssue)
543-
if err != nil {
544-
return nil, fmt.Errorf("failed to marshal response: %w", err)
545-
}
546-
547-
return mcp.NewToolResultText(string(r)), nil
515+
afterIDInt64 := int64(afterID)
516+
subIssueRequest.AfterID = &afterIDInt64
517+
}
518+
if beforeID != 0 {
519+
beforeIDInt64 := int64(beforeID)
520+
subIssueRequest.BeforeID = &beforeIDInt64
521+
}
522+
523+
subIssue, resp, err := client.SubIssue.Reprioritize(ctx, owner, repo, int64(issueNumber), subIssueRequest)
524+
if err != nil {
525+
return ghErrors.NewGitHubAPIErrorResponse(ctx,
526+
"failed to reprioritize sub-issue",
527+
resp,
528+
err,
529+
), nil
530+
}
531+
532+
defer func() { _ = resp.Body.Close() }()
533+
534+
if resp.StatusCode != http.StatusOK {
535+
body, err := io.ReadAll(resp.Body)
536+
if err != nil {
537+
return nil, fmt.Errorf("failed to read response body: %w", err)
538+
}
539+
return mcp.NewToolResultError(fmt.Sprintf("failed to reprioritize sub-issue: %s", string(body))), nil
540+
}
541+
542+
r, err := json.Marshal(subIssue)
543+
if err != nil {
544+
return nil, fmt.Errorf("failed to marshal response: %w", err)
545+
}
546+
547+
return mcp.NewToolResultText(string(r)), nil
548548
}
549549
}
550550

0 commit comments

Comments
 (0)