From c4462084bc0699c63836e02647ce1164dbda237f Mon Sep 17 00:00:00 2001 From: Ariel Deitcher Date: Thu, 3 Apr 2025 13:51:21 -0700 Subject: [PATCH 1/7] increase runner size to xl --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index b4583b01..bf978fe3 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -23,7 +23,7 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-xl permissions: contents: read packages: write From 761601f5ca62ef26a969f50fc4b1fb583b402117 Mon Sep 17 00:00:00 2001 From: Ariel Deitcher Date: Thu, 3 Apr 2025 14:07:48 -0700 Subject: [PATCH 2/7] setup-go --- .github/workflows/docker-publish.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index bf978fe3..2f1bfa2d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -35,6 +35,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: ./go.mod + check-latest: true + # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer - name: Install cosign From d3b06c0f4f1b354bccf6ac9113c6872701d93dba Mon Sep 17 00:00:00 2001 From: Ariel Deitcher Date: Thu, 3 Apr 2025 14:35:42 -0700 Subject: [PATCH 3/7] more cacheing --- .github/workflows/docker-publish.yml | 16 +++++++++++----- Dockerfile | 13 +++++++++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 2f1bfa2d..4c370ebe 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -35,11 +35,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: ./go.mod - check-latest: true - # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer - name: Install cosign @@ -72,6 +67,17 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Go Build Cache for Docker + uses: actions/cache@v4 + with: + path: go-build-cache + key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} + + - name: Inject go-build-cache + uses: reproducible-containers/buildkit-cache-dance@4b2444fec0c0fb9dbf175a96c094720a692ef810 # v2.1.4 + with: + cache-source: go-build-cache + # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action - name: Build and push Docker image diff --git a/Dockerfile b/Dockerfile index 6b96ffec..05fe1ddd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,18 @@ FROM golang:1.23.7 AS build ARG VERSION # Set the working directory WORKDIR /build -# Copy the current directory contents into the working directory -COPY . . + +RUN go env -w GOMODCACHE=/root/.cache/go-build + # Install dependencies -RUN go mod download +COPY go.mod go.sum ./ +RUN --mount=type=cache,target=/root/.cache/go-build go mod download + +COPY . ./ # Build the server -RUN CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION} -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ +RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION} -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ -o github-mcp-server cmd/github-mcp-server/main.go + # Make a stage to run the app FROM gcr.io/distroless/base-debian12 # Set the working directory From 4cdcace8820c94e93c2525488e47c9a228a5b4b0 Mon Sep 17 00:00:00 2001 From: Ariel Deitcher Date: Thu, 3 Apr 2025 14:47:37 -0700 Subject: [PATCH 4/7] standardize --- pkg/github/issues.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/github/issues.go b/pkg/github/issues.go index a62213ea..7de8348f 100644 --- a/pkg/github/issues.go +++ b/pkg/github/issues.go @@ -20,15 +20,15 @@ func getIssue(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.WithDescription(t("TOOL_GET_ISSUE_DESCRIPTION", "Get details of a specific issue in a GitHub repository.")), mcp.WithString("owner", mcp.Required(), - mcp.Description("The owner of the repository."), + mcp.Description("The owner of the repository"), ), mcp.WithString("repo", mcp.Required(), - mcp.Description("The name of the repository."), + mcp.Description("The name of the repository"), ), mcp.WithNumber("issue_number", mcp.Required(), - mcp.Description("The number of the issue."), + mcp.Description("The number of the issue"), ), ), func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { From 1f294c1b9039472f5734ca5584eef850f83eccce Mon Sep 17 00:00:00 2001 From: Ariel Deitcher Date: Thu, 3 Apr 2025 14:49:40 -0700 Subject: [PATCH 5/7] more standardization --- pkg/github/code_scanning.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/github/code_scanning.go b/pkg/github/code_scanning.go index 380dc02c..4d68bf0c 100644 --- a/pkg/github/code_scanning.go +++ b/pkg/github/code_scanning.go @@ -18,15 +18,15 @@ func getCodeScanningAlert(client *github.Client, t translations.TranslationHelpe mcp.WithDescription(t("TOOL_GET_CODE_SCANNING_ALERT_DESCRIPTION", "Get details of a specific code scanning alert in a GitHub repository.")), mcp.WithString("owner", mcp.Required(), - mcp.Description("The owner of the repository."), + mcp.Description("The owner of the repository"), ), mcp.WithString("repo", mcp.Required(), - mcp.Description("The name of the repository."), + mcp.Description("The name of the repository"), ), mcp.WithNumber("alert_number", mcp.Required(), - mcp.Description("The number of the alert."), + mcp.Description("The number of the alert"), ), ), func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { From 636c4a8784c4c02be997b09af69f295eb75d2d8b Mon Sep 17 00:00:00 2001 From: Ariel Deitcher Date: Thu, 3 Apr 2025 15:03:37 -0700 Subject: [PATCH 6/7] Revert "standardize" This reverts commit 4cdcace8820c94e93c2525488e47c9a228a5b4b0. --- pkg/github/issues.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/github/issues.go b/pkg/github/issues.go index 7de8348f..a62213ea 100644 --- a/pkg/github/issues.go +++ b/pkg/github/issues.go @@ -20,15 +20,15 @@ func getIssue(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.WithDescription(t("TOOL_GET_ISSUE_DESCRIPTION", "Get details of a specific issue in a GitHub repository.")), mcp.WithString("owner", mcp.Required(), - mcp.Description("The owner of the repository"), + mcp.Description("The owner of the repository."), ), mcp.WithString("repo", mcp.Required(), - mcp.Description("The name of the repository"), + mcp.Description("The name of the repository."), ), mcp.WithNumber("issue_number", mcp.Required(), - mcp.Description("The number of the issue"), + mcp.Description("The number of the issue."), ), ), func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { From 5e9f1ae2bbc82820a8b85def9273c28299a0a86f Mon Sep 17 00:00:00 2001 From: Ariel Deitcher Date: Thu, 3 Apr 2025 15:03:44 -0700 Subject: [PATCH 7/7] Revert "more standardization" This reverts commit 1f294c1b9039472f5734ca5584eef850f83eccce. --- pkg/github/code_scanning.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/github/code_scanning.go b/pkg/github/code_scanning.go index 4d68bf0c..380dc02c 100644 --- a/pkg/github/code_scanning.go +++ b/pkg/github/code_scanning.go @@ -18,15 +18,15 @@ func getCodeScanningAlert(client *github.Client, t translations.TranslationHelpe mcp.WithDescription(t("TOOL_GET_CODE_SCANNING_ALERT_DESCRIPTION", "Get details of a specific code scanning alert in a GitHub repository.")), mcp.WithString("owner", mcp.Required(), - mcp.Description("The owner of the repository"), + mcp.Description("The owner of the repository."), ), mcp.WithString("repo", mcp.Required(), - mcp.Description("The name of the repository"), + mcp.Description("The name of the repository."), ), mcp.WithNumber("alert_number", mcp.Required(), - mcp.Description("The number of the alert"), + mcp.Description("The number of the alert."), ), ), func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {