Skip to content

Commit 0e8534c

Browse files
authored
chore: add pre-commit hooks [MCP-284] (#727)
1 parent f307567 commit 0e8534c

File tree

5 files changed

+73
-1
lines changed

5 files changed

+73
-1
lines changed

.github/workflows/code-health.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,22 @@ jobs:
136136
uses: coverallsapp/github-action@v2.3.6
137137
with:
138138
file: coverage/lcov.info
139+
140+
run-git-secrets:
141+
name: Run git secrets
142+
if: github.event_name == 'push' || (github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository)
143+
runs-on: ubuntu-latest
144+
steps:
145+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
146+
- uses: actions/checkout@v5
147+
with:
148+
persist-credentials: false
149+
- uses: actions/setup-node@v6
150+
with:
151+
node-version-file: package.json
152+
cache: "npm"
153+
- name: Install dependencies
154+
run: |
155+
sudo apt-get install -y git-secrets
156+
- name: Run git-secrets
157+
run: git-secrets --register-aws && git-secrets --scan

.husky/pre-commit

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
if [ ! "$(which git-secrets)" ]
4+
then
5+
echo "git-secrets is not installed. Please run 'brew install git-secrets' or visit https://github.com/awslabs/git-secrets#installing-git-secrets"
6+
exit 1
7+
fi
8+
9+
git-secrets --register-aws > /dev/null
10+
git-secrets --scan

package-lock.json

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"scripts": {
3636
"start": "node dist/index.js --transport http --loggers stderr mcp",
3737
"start:stdio": "node dist/index.js --transport stdio --loggers stderr mcp",
38-
"prepare": "npm run build",
38+
"prepare": "husky && npm run build",
3939
"build:clean": "rm -rf dist",
4040
"build:update-package-version": "tsx scripts/updatePackageVersion.ts",
4141
"build:esm": "tsc --project tsconfig.esm.json && chmod +x dist/esm/index.js",
@@ -84,6 +84,7 @@
8484
"eslint-config-prettier": "^10.1.8",
8585
"eslint-plugin-prettier": "^5.5.4",
8686
"globals": "^16.3.0",
87+
"husky": "^9.1.7",
8788
"knip": "^5.63.1",
8889
"mongodb": "^6.19.0",
8990
"mongodb-runner": "^5.9.2",

tests/integration/fixtures/httpsServerProxyTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export class HTTPServerProxyTestSetup {
4343
}
4444

4545
requests: IncomingMessage[];
46+
47+
// note: these are self-signed certs for testing purposes, DO NOT use in production
4648
tlsOptions = Object.freeze({
4749
key: readFileSync(path.resolve(__dirname, "server.key")),
4850
cert: readFileSync(path.resolve(__dirname, "server.pem")),

0 commit comments

Comments
 (0)