Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add missing milestone tocreate_issue#88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
williammartin merged 2 commits intomainfromwm/missing-milestone
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletionspkg/github/issues.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -261,6 +261,9 @@ func createIssue(client *github.Client, t translations.TranslationHelperFunc) (t
},
),
),
mcp.WithNumber("milestone",
mcp.Description("Milestone number"),
),
),
func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
owner, err := requiredParam[string](request, "owner")
Expand DownExpand Up@@ -294,12 +297,24 @@ func createIssue(client *github.Client, t translations.TranslationHelperFunc) (t
return mcp.NewToolResultError(err.Error()), nil
}

// Get optional milestone
milestone, err := optionalIntParam(request, "milestone")
if err != nil {
return mcp.NewToolResultError(err.Error()), nil
}

var milestoneNum *int
if milestone != 0 {
milestoneNum = &milestone
}

// Create the issue request
issueRequest := &github.IssueRequest{
Title: github.Ptr(title),
Body: github.Ptr(body),
Assignees: &assignees,
Labels: &labels,
Milestone: milestoneNum,
}

issue, resp, err := client.Issues.Create(ctx, owner, repo, issueRequest)
Expand Down
4 changes: 4 additions & 0 deletionspkg/github/issues_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -392,6 +392,7 @@ func Test_CreateIssue(t *testing.T) {
assert.Contains(t, tool.InputSchema.Properties, "body")
assert.Contains(t, tool.InputSchema.Properties, "assignees")
assert.Contains(t, tool.InputSchema.Properties, "labels")
assert.Contains(t, tool.InputSchema.Properties, "milestone")
assert.ElementsMatch(t, tool.InputSchema.Required, []string{"owner", "repo", "title"})

// Setup mock issue for success case
Expand All@@ -403,6 +404,7 @@ func Test_CreateIssue(t *testing.T) {
HTMLURL: github.Ptr("https://github.com/owner/repo/issues/123"),
Assignees: []*github.User{{Login: github.Ptr("user1")}, {Login: github.Ptr("user2")}},
Labels: []*github.Label{{Name: github.Ptr("bug")}, {Name: github.Ptr("help wanted")}},
Milestone: &github.Milestone{Number: github.Ptr(5)},
}

tests := []struct {
Expand All@@ -423,6 +425,7 @@ func Test_CreateIssue(t *testing.T) {
"body": "This is a test issue",
"labels": []any{"bug", "help wanted"},
"assignees": []any{"user1", "user2"},
"milestone": float64(5),
}).andThen(
mockResponse(t, http.StatusCreated, mockIssue),
),
Expand All@@ -435,6 +438,7 @@ func Test_CreateIssue(t *testing.T) {
"body": "This is a test issue",
"assignees": []string{"user1", "user2"},
"labels": []string{"bug", "help wanted"},
"milestone": float64(5),
},
expectError: false,
expectedIssue: mockIssue,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp