From 5f4ab33ed6310b16ec1767171bad2d6409a3fb86 Mon Sep 17 00:00:00 2001 From: Matt Holloway Date: Wed, 10 Sep 2025 17:08:06 +0100 Subject: [PATCH 1/4] add return ID to crud tools --- pkg/github/gists.go | 2 ++ pkg/github/issues.go | 2 ++ pkg/github/minimal_types.go | 1 + pkg/github/pullrequests.go | 2 ++ pkg/github/repositories.go | 2 ++ 5 files changed, 9 insertions(+) diff --git a/pkg/github/gists.go b/pkg/github/gists.go index 3f1645f3e..53e85d5ba 100644 --- a/pkg/github/gists.go +++ b/pkg/github/gists.go @@ -166,6 +166,7 @@ func CreateGist(getClient GetClientFn, t translations.TranslationHelperFunc) (to } minimalResponse := MinimalResponse{ + ID: createdGist.GetID(), URL: createdGist.GetHTMLURL(), } @@ -254,6 +255,7 @@ func UpdateGist(getClient GetClientFn, t translations.TranslationHelperFunc) (to } minimalResponse := MinimalResponse{ + ID: updatedGist.GetID(), URL: updatedGist.GetHTMLURL(), } diff --git a/pkg/github/issues.go b/pkg/github/issues.go index 01ce7b42e..b5e75b0e6 100644 --- a/pkg/github/issues.go +++ b/pkg/github/issues.go @@ -874,6 +874,7 @@ func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t // Return minimal response with just essential information minimalResponse := MinimalResponse{ + ID: fmt.Sprintf("%d", issue.GetID()), URL: issue.GetHTMLURL(), } @@ -1249,6 +1250,7 @@ func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t // Return minimal response with just essential information minimalResponse := MinimalResponse{ + ID: fmt.Sprintf("%d", updatedIssue.GetID()), URL: updatedIssue.GetHTMLURL(), } diff --git a/pkg/github/minimal_types.go b/pkg/github/minimal_types.go index 0c3c220aa..099b87481 100644 --- a/pkg/github/minimal_types.go +++ b/pkg/github/minimal_types.go @@ -110,6 +110,7 @@ type MinimalBranch struct { // Success is implicit in the HTTP response status, and all other information // can be derived from the URL or fetched separately if needed. type MinimalResponse struct { + ID string `json:"id"` URL string `json:"url"` } diff --git a/pkg/github/pullrequests.go b/pkg/github/pullrequests.go index b2e4e9290..8289a4e48 100644 --- a/pkg/github/pullrequests.go +++ b/pkg/github/pullrequests.go @@ -195,6 +195,7 @@ func CreatePullRequest(getClient GetClientFn, t translations.TranslationHelperFu // Return minimal response with just essential information minimalResponse := MinimalResponse{ + ID: fmt.Sprintf("%d", pr.GetID()), URL: pr.GetHTMLURL(), } @@ -471,6 +472,7 @@ func UpdatePullRequest(getClient GetClientFn, getGQLClient GetGQLClientFn, t tra // Return minimal response with just essential information minimalResponse := MinimalResponse{ + ID: fmt.Sprintf("%d", finalPR.GetID()), URL: finalPR.GetHTMLURL(), } diff --git a/pkg/github/repositories.go b/pkg/github/repositories.go index cef227ba5..cc68375b4 100644 --- a/pkg/github/repositories.go +++ b/pkg/github/repositories.go @@ -468,6 +468,7 @@ func CreateRepository(getClient GetClientFn, t translations.TranslationHelperFun // Return minimal response with just essential information minimalResponse := MinimalResponse{ + ID: fmt.Sprintf("%d", createdRepo.GetID()), URL: createdRepo.GetHTMLURL(), } @@ -744,6 +745,7 @@ func ForkRepository(getClient GetClientFn, t translations.TranslationHelperFunc) // Return minimal response with just essential information minimalResponse := MinimalResponse{ + ID: fmt.Sprintf("%d", forkedRepo.GetID()), URL: forkedRepo.GetHTMLURL(), } From 634b3231fa70d4d4a3e5046337ade47c61dca17b Mon Sep 17 00:00:00 2001 From: Matt Holloway Date: Wed, 10 Sep 2025 17:11:10 +0100 Subject: [PATCH 2/4] Update pkg/github/gists.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- pkg/github/gists.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/github/gists.go b/pkg/github/gists.go index 53e85d5ba..47b035365 100644 --- a/pkg/github/gists.go +++ b/pkg/github/gists.go @@ -166,7 +166,7 @@ func CreateGist(getClient GetClientFn, t translations.TranslationHelperFunc) (to } minimalResponse := MinimalResponse{ - ID: createdGist.GetID(), + ID: fmt.Sprintf("%s", createdGist.GetID()), URL: createdGist.GetHTMLURL(), } From 022c95180974d5281f722bb63f97f03294d89b14 Mon Sep 17 00:00:00 2001 From: Matt Holloway Date: Wed, 10 Sep 2025 17:11:16 +0100 Subject: [PATCH 3/4] Update pkg/github/gists.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- pkg/github/gists.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/github/gists.go b/pkg/github/gists.go index 47b035365..4139314d1 100644 --- a/pkg/github/gists.go +++ b/pkg/github/gists.go @@ -255,7 +255,7 @@ func UpdateGist(getClient GetClientFn, t translations.TranslationHelperFunc) (to } minimalResponse := MinimalResponse{ - ID: updatedGist.GetID(), + ID: fmt.Sprintf("%s", updatedGist.GetID()), URL: updatedGist.GetHTMLURL(), } From 33c689b7e7008084454ed72f93d8217867294e21 Mon Sep 17 00:00:00 2001 From: Matt Holloway Date: Wed, 10 Sep 2025 17:14:17 +0100 Subject: [PATCH 4/4] fix gist id to string conv --- pkg/github/gists.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/github/gists.go b/pkg/github/gists.go index 4139314d1..53e85d5ba 100644 --- a/pkg/github/gists.go +++ b/pkg/github/gists.go @@ -166,7 +166,7 @@ func CreateGist(getClient GetClientFn, t translations.TranslationHelperFunc) (to } minimalResponse := MinimalResponse{ - ID: fmt.Sprintf("%s", createdGist.GetID()), + ID: createdGist.GetID(), URL: createdGist.GetHTMLURL(), } @@ -255,7 +255,7 @@ func UpdateGist(getClient GetClientFn, t translations.TranslationHelperFunc) (to } minimalResponse := MinimalResponse{ - ID: fmt.Sprintf("%s", updatedGist.GetID()), + ID: updatedGist.GetID(), URL: updatedGist.GetHTMLURL(), }