From e03d12f38641b92f72a7cb451492e9ff07b36732 Mon Sep 17 00:00:00 2001 From: JoannaaKL Date: Wed, 2 Jul 2025 17:59:58 +0200 Subject: [PATCH 1/2] Remove unused function and add test script --- pkg/github/discussions.go | 50 --------------------------------------- script/lint | 1 - script/test | 3 +++ 3 files changed, 3 insertions(+), 51 deletions(-) create mode 100755 script/test diff --git a/pkg/github/discussions.go b/pkg/github/discussions.go index d61fe969d..a7ec8e20f 100644 --- a/pkg/github/discussions.go +++ b/pkg/github/discussions.go @@ -13,56 +13,6 @@ import ( "github.com/shurcooL/githubv4" ) -// GetAllDiscussionCategories retrieves all discussion categories for a repository -// by paginating through all pages and returns them as a map where the key is the -// category name and the value is the category ID. -func GetAllDiscussionCategories(ctx context.Context, client *githubv4.Client, owner, repo string) (map[string]string, error) { - categories := make(map[string]string) - var after string - hasNextPage := true - - for hasNextPage { - // Prepare GraphQL query with pagination - var q struct { - Repository struct { - DiscussionCategories struct { - Nodes []struct { - ID githubv4.ID - Name githubv4.String - } - PageInfo struct { - HasNextPage githubv4.Boolean - EndCursor githubv4.String - } - } `graphql:"discussionCategories(first: 100, after: $after)"` - } `graphql:"repository(owner: $owner, name: $repo)"` - } - - vars := map[string]interface{}{ - "owner": githubv4.String(owner), - "repo": githubv4.String(repo), - "after": githubv4.String(after), - } - - if err := client.Query(ctx, &q, vars); err != nil { - return nil, fmt.Errorf("failed to query discussion categories: %w", err) - } - - // Add categories to the map - for _, category := range q.Repository.DiscussionCategories.Nodes { - categories[string(category.Name)] = fmt.Sprint(category.ID) - } - - // Check if there are more pages - hasNextPage = bool(q.Repository.DiscussionCategories.PageInfo.HasNextPage) - if hasNextPage { - after = string(q.Repository.DiscussionCategories.PageInfo.EndCursor) - } - } - - return categories, nil -} - func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { return mcp.NewTool("list_discussions", mcp.WithDescription(t("TOOL_LIST_DISCUSSIONS_DESCRIPTION", "List discussions for a repository")), diff --git a/script/lint b/script/lint index 58884e3a0..e6ea9da89 100755 --- a/script/lint +++ b/script/lint @@ -7,7 +7,6 @@ BINDIR="$(git rev-parse --show-toplevel)"/bin BINARY=$BINDIR/golangci-lint GOLANGCI_LINT_VERSION=v2.2.1 - if [ ! -f "$BINARY" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "$GOLANGCI_LINT_VERSION" fi diff --git a/script/test b/script/test new file mode 100755 index 000000000..c8e590d5c --- /dev/null +++ b/script/test @@ -0,0 +1,3 @@ +set -eu + +go test -race ./... \ No newline at end of file From 31d76c4b59b40de23ef446fc8771bfa64d9948f0 Mon Sep 17 00:00:00 2001 From: JoannaaKL Date: Wed, 2 Jul 2025 18:03:10 +0200 Subject: [PATCH 2/2] Call test from the workflow --- .github/workflows/go.yml | 2 +- script/test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0a45569ec..e3ef25022 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -26,7 +26,7 @@ jobs: run: go mod download - name: Run unit tests - run: go test -race ./... + run: script/test - name: Build run: go build -v ./cmd/github-mcp-server diff --git a/script/test b/script/test index c8e590d5c..7f0dd0c20 100755 --- a/script/test +++ b/script/test @@ -1,3 +1,3 @@ set -eu -go test -race ./... \ No newline at end of file +go test -race ./... \ No newline at end of file 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