Skip to content

Commit fd28c20

Browse files
committed
build: simplify command references and update build info generation
- Replaced direct file paths with relative command paths in scripts and config files for consistency. - Enhanced build info generation with improved handling of commit and branch information. - Updated `.gitignore` to include dynamic build info files. - Enabled write access in Dockerfile bind mount to align with changes.
1 parent 470a374 commit fd28c20

File tree

7 files changed

+11
-13
lines changed

7 files changed

+11
-13
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.github
22
.vscode
3-
script
43
third-party
54
.dockerignore
65
.gitignore

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.idea
2-
cmd/github-mcp-server/github-mcp-server
1+
.idea/
2+
cmd/github-mcp-server/build_info/*.txt
33

44
# VSCode
55
.vscode/*

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"request": "launch",
1111
"mode": "auto",
1212
"cwd": "${workspaceFolder}",
13-
"program": "cmd/github-mcp-server/main.go",
13+
"program": "./cmd/github-mcp-server",
1414
"args": ["stdio"],
1515
"console": "integratedTerminal",
1616
},
@@ -20,7 +20,7 @@
2020
"request": "launch",
2121
"mode": "auto",
2222
"cwd": "${workspaceFolder}",
23-
"program": "cmd/github-mcp-server/main.go",
23+
"program": "./cmd/github-mcp-server",
2424
"args": ["stdio", "--read-only"],
2525
"console": "integratedTerminal",
2626
}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ RUN --mount=type=cache,target=/var/cache/apk \
1111
# go build automatically download required module dependencies to /go/pkg/mod
1212
RUN --mount=type=cache,target=/go/pkg/mod \
1313
--mount=type=cache,target=/root/.cache/go-build \
14-
--mount=type=bind,target=. \
14+
--mount=type=bind,target=.,rw \
1515
script/prepare-build-info && \
1616
CGO_ENABLED=0 go build -ldflags="-s -w" \
17-
-o /bin/github-mcp-server cmd/github-mcp-server/main.go
17+
-o /bin/github-mcp-server ./cmd/github-mcp-server
1818

1919
# Make a stage to run the app
2020
FROM gcr.io/distroless/base-debian12

script/get-discussions

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
22

3-
# echo '{"jsonrpc":"2.0","id":3,"params":{"name":"list_discussions","arguments": {"owner": "github", "repo": "securitylab", "first": 10, "since": "2025-04-01T00:00:00Z"}},"method":"tools/call"}' | go run cmd/github-mcp-server/main.go stdio | jq .
4-
echo '{"jsonrpc":"2.0","id":3,"params":{"name":"list_discussions","arguments": {"owner": "github", "repo": "securitylab", "first": 10, "since": "2025-04-01T00:00:00Z", "sort": "CREATED_AT", "direction": "DESC"}},"method":"tools/call"}' | go run cmd/github-mcp-server/main.go stdio | jq .
5-
3+
# echo '{"jsonrpc":"2.0","id":3,"params":{"name":"list_discussions","arguments": {"owner": "github", "repo": "securitylab", "first": 10, "since": "2025-04-01T00:00:00Z"}},"method":"tools/call"}' | go run ./cmd/github-mcp-server stdio | jq .
4+
echo '{"jsonrpc":"2.0","id":3,"params":{"name":"list_discussions","arguments": {"owner": "github", "repo": "securitylab", "first": 10, "since": "2025-04-01T00:00:00Z", "sort": "CREATED_AT", "direction": "DESC"}},"method":"tools/call"}' | go run ./cmd/github-mcp-server stdio | jq .

script/get-me

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
echo '{"jsonrpc":"2.0","id":3,"params":{"name":"get_me"},"method":"tools/call"}' | go run cmd/github-mcp-server/main.go stdio | jq .
3+
echo '{"jsonrpc":"2.0","id":3,"params":{"name":"get_me"},"method":"tools/call"}' | go run ./cmd/github-mcp-server stdio | jq .

script/prepare-build-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ if [ -n "${GITHUB_ACTIONS:-}" ]; then
1919
fi
2020
else
2121
# Local/Docker context
22-
COMMIT=$(git rev-parse HEAD 2>/dev/null || echo 'unknown')
23-
VERSION="dev"
22+
COMMIT=$(git rev-parse HEAD 2>/dev/null || echo 'unknown commit')
23+
VERSION=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo 'unknown version')
2424
fi
2525

2626
# Write build info files

0 commit comments

Comments
 (0)