Skip to content

Commit 6728736

Browse files
authored
Use github ptr
1 parent 64f6fb4 commit 6728736

File tree

1 file changed

+37
-34
lines changed

1 file changed

+37
-34
lines changed

pkg/github/issues.go

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -553,39 +553,39 @@ func RemoveSubIssue(getClient GetClientFn, t translations.TranslationHelperFunc)
553553
}
554554

555555
client, err := getClient(ctx)
556-
if err != nil {
557-
return nil, fmt.Errorf("failed to get GitHub client: %w", err)
558-
}
559-
560-
subIssueRequest := github.SubIssueRequest{
561-
SubIssueID: int64(subIssueID),
562-
}
563-
564-
subIssue, resp, err := client.SubIssue.Remove(ctx, owner, repo, int64(issueNumber), subIssueRequest)
565-
if err != nil {
566-
return ghErrors.NewGitHubAPIErrorResponse(ctx,
567-
"failed to remove sub-issue",
568-
resp,
569-
err,
570-
), nil
571-
}
572-
defer func() { _ = resp.Body.Close() }()
573-
574-
if resp.StatusCode != http.StatusOK {
575-
body, err := io.ReadAll(resp.Body)
576-
if err != nil {
577-
return nil, fmt.Errorf("failed to read response body: %w", err)
578-
}
579-
return mcp.NewToolResultError(fmt.Sprintf("failed to remove sub-issue: %s", string(body))), nil
580-
}
581-
582-
r, err := json.Marshal(subIssue)
583-
if err != nil {
584-
return nil, fmt.Errorf("failed to marshal response: %w", err)
585-
}
586-
587-
return mcp.NewToolResultText(string(r)), nil
588-
}
556+
if err != nil {
557+
return nil, fmt.Errorf("failed to get GitHub client: %w", err)
558+
}
559+
560+
subIssueRequest := github.SubIssueRequest{
561+
SubIssueID: int64(subIssueID),
562+
}
563+
564+
subIssue, resp, err := client.SubIssue.Remove(ctx, owner, repo, int64(issueNumber), subIssueRequest)
565+
if err != nil {
566+
return ghErrors.NewGitHubAPIErrorResponse(ctx,
567+
"failed to remove sub-issue",
568+
resp,
569+
err,
570+
), nil
571+
}
572+
defer func() { _ = resp.Body.Close() }()
573+
574+
if resp.StatusCode != http.StatusOK {
575+
body, err := io.ReadAll(resp.Body)
576+
if err != nil {
577+
return nil, fmt.Errorf("failed to read response body: %w", err)
578+
}
579+
return mcp.NewToolResultError(fmt.Sprintf("failed to remove sub-issue: %s", string(body))), nil
580+
}
581+
582+
r, err := json.Marshal(subIssue)
583+
if err != nil {
584+
return nil, fmt.Errorf("failed to marshal response: %w", err)
585+
}
586+
587+
return mcp.NewToolResultText(string(r)), nil
588+
}
589589
}
590590

591591
// ReprioritizeSubIssue creates a tool to reprioritize a sub-issue to a different position in the parent list.
@@ -848,7 +848,10 @@ func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
848848
Assignees: &assignees,
849849
Labels: &labels,
850850
Milestone: milestoneNum,
851-
Type: typePtr,
851+
}
852+
853+
if issueType != "" {
854+
issueRequest.Type = github.Ptr(issueType)
852855
}
853856

854857
client, err := getClient(ctx)

0 commit comments

Comments
 (0)