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

Commit254be46

Browse files
committed
Add missing milestone to create_issue
1 parentca1a8f9 commit254be46

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

‎pkg/github/issues.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ func createIssue(client *github.Client, t translations.TranslationHelperFunc) (t
261261
},
262262
),
263263
),
264+
mcp.WithNumber("milestone",
265+
mcp.Description("New milestone number"),
266+
),
264267
),
265268
func(ctx context.Context,request mcp.CallToolRequest) (*mcp.CallToolResult,error) {
266269
owner,err:=requiredParam[string](request,"owner")
@@ -294,12 +297,24 @@ func createIssue(client *github.Client, t translations.TranslationHelperFunc) (t
294297
returnmcp.NewToolResultError(err.Error()),nil
295298
}
296299

300+
// Get optional milestone
301+
milestone,err:=optionalIntParam(request,"milestone")
302+
iferr!=nil {
303+
returnmcp.NewToolResultError(err.Error()),nil
304+
}
305+
306+
varmilestoneNum*int
307+
ifmilestone!=0 {
308+
milestoneNum=&milestone
309+
}
310+
297311
// Create the issue request
298312
issueRequest:=&github.IssueRequest{
299313
Title:github.Ptr(title),
300314
Body:github.Ptr(body),
301315
Assignees:&assignees,
302316
Labels:&labels,
317+
Milestone:milestoneNum,
303318
}
304319

305320
issue,resp,err:=client.Issues.Create(ctx,owner,repo,issueRequest)

‎pkg/github/issues_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ func Test_CreateIssue(t *testing.T) {
392392
assert.Contains(t,tool.InputSchema.Properties,"body")
393393
assert.Contains(t,tool.InputSchema.Properties,"assignees")
394394
assert.Contains(t,tool.InputSchema.Properties,"labels")
395+
assert.Contains(t,tool.InputSchema.Properties,"milestone")
395396
assert.ElementsMatch(t,tool.InputSchema.Required, []string{"owner","repo","title"})
396397

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

408410
tests:= []struct {
@@ -423,6 +425,7 @@ func Test_CreateIssue(t *testing.T) {
423425
"body":"This is a test issue",
424426
"labels": []any{"bug","help wanted"},
425427
"assignees": []any{"user1","user2"},
428+
"milestone":float64(5),
426429
}).andThen(
427430
mockResponse(t,http.StatusCreated,mockIssue),
428431
),
@@ -435,6 +438,7 @@ func Test_CreateIssue(t *testing.T) {
435438
"body":"This is a test issue",
436439
"assignees": []string{"user1","user2"},
437440
"labels": []string{"bug","help wanted"},
441+
"milestone":float64(5),
438442
},
439443
expectError:false,
440444
expectedIssue:mockIssue,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp