Skip to content

Commit ff6e859

Browse files
authored
add title to get_discussion query (github#803)
1 parent 45e90ae commit ff6e859

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pkg/github/discussions.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ func GetDiscussion(getGQLClient GetGQLClientFn, t translations.TranslationHelper
295295
Repository struct {
296296
Discussion struct {
297297
Number githubv4.Int
298+
Title githubv4.String
298299
Body githubv4.String
299300
CreatedAt githubv4.DateTime
300301
URL githubv4.String `graphql:"url"`
@@ -315,6 +316,7 @@ func GetDiscussion(getGQLClient GetGQLClientFn, t translations.TranslationHelper
315316
d := q.Repository.Discussion
316317
discussion := &github.Discussion{
317318
Number: github.Ptr(int(d.Number)),
319+
Title: github.Ptr(string(d.Title)),
318320
Body: github.Ptr(string(d.Body)),
319321
HTMLURL: github.Ptr(string(d.URL)),
320322
CreatedAt: &github.Timestamp{Time: d.CreatedAt.Time},

pkg/github/discussions_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ func Test_GetDiscussion(t *testing.T) {
484484
assert.ElementsMatch(t, toolDef.InputSchema.Required, []string{"owner", "repo", "discussionNumber"})
485485

486486
// Use exact string query that matches implementation output
487-
qGetDiscussion := "query($discussionNumber:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussion(number: $discussionNumber){number,body,createdAt,url,category{name}}}}"
487+
qGetDiscussion := "query($discussionNumber:Int!$owner:String!$repo:String!){repository(owner: $owner, name: $repo){discussion(number: $discussionNumber){number,title,body,createdAt,url,category{name}}}}"
488488

489489
vars := map[string]interface{}{
490490
"owner": "owner",
@@ -503,6 +503,7 @@ func Test_GetDiscussion(t *testing.T) {
503503
response: githubv4mock.DataResponse(map[string]any{
504504
"repository": map[string]any{"discussion": map[string]any{
505505
"number": 1,
506+
"title": "Test Discussion Title",
506507
"body": "This is a test discussion",
507508
"url": "https://github.com/owner/repo/discussions/1",
508509
"createdAt": "2025-04-25T12:00:00Z",
@@ -513,6 +514,7 @@ func Test_GetDiscussion(t *testing.T) {
513514
expected: &github.Discussion{
514515
HTMLURL: github.Ptr("https://github.com/owner/repo/discussions/1"),
515516
Number: github.Ptr(1),
517+
Title: github.Ptr("Test Discussion Title"),
516518
Body: github.Ptr("This is a test discussion"),
517519
CreatedAt: &github.Timestamp{Time: time.Date(2025, 4, 25, 12, 0, 0, 0, time.UTC)},
518520
DiscussionCategory: &github.DiscussionCategory{
@@ -549,6 +551,7 @@ func Test_GetDiscussion(t *testing.T) {
549551
require.NoError(t, json.Unmarshal([]byte(text), &out))
550552
assert.Equal(t, *tc.expected.HTMLURL, *out.HTMLURL)
551553
assert.Equal(t, *tc.expected.Number, *out.Number)
554+
assert.Equal(t, *tc.expected.Title, *out.Title)
552555
assert.Equal(t, *tc.expected.Body, *out.Body)
553556
// Check category label
554557
assert.Equal(t, *tc.expected.DiscussionCategory.Name, *out.DiscussionCategory.Name)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy