Content-Length: 5064 | pFad | http://github.com/github/github-mcp-server/pull/71.patch
thub.com
From 46d972b6210ae184b62f52bedb3c92c85416b287 Mon Sep 17 00:00:00 2001
From: Sam Morrow
Date: Thu, 3 Apr 2025 11:53:27 +0200
Subject: [PATCH 1/2] add goreleaser and associated workflows
---
.github/workflows/goreleaser.yml | 33 +++++++++++++++++++++++
.gitignore | 2 ++
.goreleaser.yaml | 46 ++++++++++++++++++++++++++++++++
cmd/github-mcp-server/main.go | 13 ++++++---
4 files changed, 90 insertions(+), 4 deletions(-)
create mode 100644 .github/workflows/goreleaser.yml
create mode 100644 .goreleaser.yaml
diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml
new file mode 100644
index 000000000..4cc9c2c54
--- /dev/null
+++ b/.github/workflows/goreleaser.yml
@@ -0,0 +1,33 @@
+name: GoReleaser Release
+on:
+ push:
+ tags:
+ - "v*"
+permissions:
+ contents: write
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v4
+
+ - name: Set up Go
+ uses: actions/setup-go@v5
+ with:
+ go-version-file: "go.mod"
+
+ - name: Download dependencies
+ run: go mod download
+
+ - name: Run GoReleaser
+ uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552
+ with:
+ distribution: goreleaser
+ # GoReleaser version
+ version: "~> v2"
+ # Arguments to pass to GoReleaser
+ args: release --clean
+ workdir: .
diff --git a/.gitignore b/.gitignore
index b753d0e8c..243e145cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
.idea
cmd/github-mcp-server/github-mcp-server
+# Added by goreleaser init:
+dist/
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
new file mode 100644
index 000000000..62da79cf4
--- /dev/null
+++ b/.goreleaser.yaml
@@ -0,0 +1,46 @@
+version: 2
+project_name: github-mcp-server
+before:
+ hooks:
+ - go mod tidy
+ - go generate ./...
+ - script/licenses
+ - cp -r ./third-party/ ./dist
+ - cp third-party-licenses.md ./dist/third-party-licenses.md
+
+builds:
+ - env:
+ - CGO_ENABLED=0
+ ldflags:
+ - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
+ goos:
+ - linux
+ - windows
+ - darwin
+ main: ./cmd/github-mcp-server
+
+archives:
+ - formats: tar.gz
+ # this name template makes the OS and Arch compatible with the results of `uname`.
+ name_template: >-
+ {{ .ProjectName }}_
+ {{- title .Os }}_
+ {{- if eq .Arch "amd64" }}x86_64
+ {{- else if eq .Arch "386" }}i386
+ {{- else }}{{ .Arch }}{{ end }}
+ {{- if .Arm }}v{{ .Arm }}{{ end }}
+ # use zip for windows archives
+ format_overrides:
+ - goos: windows
+ formats: zip
+
+changelog:
+ sort: asc
+ filters:
+ exclude:
+ - "^docs:"
+ - "^test:"
+
+release:
+ draft: true
+ name_template: "GitHub MCP Server {{.Version}}"
diff --git a/cmd/github-mcp-server/main.go b/cmd/github-mcp-server/main.go
index 3f7e61952..8620a0fa4 100644
--- a/cmd/github-mcp-server/main.go
+++ b/cmd/github-mcp-server/main.go
@@ -19,11 +19,16 @@ import (
"github.com/spf13/viper"
)
+var version = "version"
+var commit = "commit"
+var date = "date"
+
var (
rootCmd = &cobra.Command{
- Use: "server",
- Short: "GitHub MCP Server",
- Long: `A GitHub MCP server that handles various tools and resources.`,
+ Use: "server",
+ Short: "GitHub MCP Server",
+ Long: `A GitHub MCP server that handles various tools and resources.`,
+ Version: fmt.Sprintf("%s (%s) %s", version, commit, date),
}
stdioCmd = &cobra.Command{
@@ -101,7 +106,7 @@ func runStdioServer(readOnly bool, logger *log.Logger, logCommands bool, exportT
logger.Fatal("GITHUB_PERSONAL_ACCESS_TOKEN not set")
}
ghClient := gogithub.NewClient(nil).WithAuthToken(token)
- ghClient.UserAgent = "github-mcp-server/1.0"
+ ghClient.UserAgent = fmt.Sprintf("github-mcp-server/%s", version)
// Check GH_HOST env var first, then fall back to viper config
host := os.Getenv("GH_HOST")
From 5699338b559758129a4435923c3af8b83296e257 Mon Sep 17 00:00:00 2001
From: Sam Morrow
Date: Thu, 3 Apr 2025 12:07:34 +0200
Subject: [PATCH 2/2] add env
---
.github/workflows/goreleaser.yml | 2 ++
.goreleaser.yaml | 1 +
2 files changed, 3 insertions(+)
diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml
index 4cc9c2c54..a25a3469f 100644
--- a/.github/workflows/goreleaser.yml
+++ b/.github/workflows/goreleaser.yml
@@ -31,3 +31,5 @@ jobs:
# Arguments to pass to GoReleaser
args: release --clean
workdir: .
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
index 62da79cf4..cf4760358 100644
--- a/.goreleaser.yaml
+++ b/.goreleaser.yaml
@@ -43,4 +43,5 @@ changelog:
release:
draft: true
+ prerelease: auto
name_template: "GitHub MCP Server {{.Version}}"
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/github/github-mcp-server/pull/71.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy