Skip to content

Commit 2a0359e

Browse files
authored
Git workflows (#2)
* formatting * CI * change husky to pre push
1 parent 0de2b3e commit 2a0359e

File tree

6 files changed

+135
-72
lines changed

6 files changed

+135
-72
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
env:
10+
NODE_VERSION: "22"
11+
HUSKY: 0
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ env.NODE_VERSION }}
28+
cache: "pnpm"
29+
30+
- name: Install dependencies
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Run Ultracite linter
34+
run: pnpm lint
35+
env:
36+
SKIP_ENV_VALIDATION: true
37+
38+
format:
39+
name: Format Check
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Setup pnpm
46+
uses: pnpm/action-setup@v4
47+
48+
- name: Setup Node.js
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: ${{ env.NODE_VERSION }}
52+
cache: "pnpm"
53+
54+
- name: Install dependencies
55+
run: pnpm install --frozen-lockfile
56+
57+
- name: Check formatting
58+
run: pnpm format:check
59+
env:
60+
SKIP_ENV_VALIDATION: true
61+
62+
typecheck:
63+
name: TypeScript Check
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v4
68+
69+
- name: Setup pnpm
70+
uses: pnpm/action-setup@v4
71+
72+
- name: Setup Node.js
73+
uses: actions/setup-node@v4
74+
with:
75+
node-version: ${{ env.NODE_VERSION }}
76+
cache: "pnpm"
77+
78+
- name: Install dependencies
79+
run: pnpm install --frozen-lockfile
80+
81+
- name: Run TypeScript check
82+
run: pnpm typecheck
83+
env:
84+
SKIP_ENV_VALIDATION: true
85+
86+
test:
87+
name: Tests
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout code
91+
uses: actions/checkout@v4
92+
93+
- name: Setup pnpm
94+
uses: pnpm/action-setup@v4
95+
96+
- name: Setup Node.js
97+
uses: actions/setup-node@v4
98+
with:
99+
node-version: ${{ env.NODE_VERSION }}
100+
cache: "pnpm"
101+
102+
- name: Install dependencies
103+
run: pnpm install --frozen-lockfile
104+
105+
- name: Run tests
106+
run: pnpm test -- --reporter=dot
107+
env:
108+
SKIP_ENV_VALIDATION: true

.husky/pre-commit

Lines changed: 0 additions & 68 deletions
This file was deleted.

.husky/pre-push

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
# Exit on any error
3+
set -e
4+
5+
echo "Running pre-push checks..."
6+
7+
# Run lint check
8+
echo "→ Linting..."
9+
pnpm lint
10+
11+
# Run format check
12+
echo "→ Checking formatting..."
13+
pnpm format:check
14+
15+
# Run typecheck
16+
echo "→ Type checking..."
17+
pnpm typecheck
18+
19+
echo "✅ All pre-push checks passed!"

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"lint": "ultracite check",
1111
"lint:fix": "ultracite fix",
1212
"format": "biome format --write",
13+
"format:check": "biome format",
1314
"typecheck": "tsc --noEmit",
1415
"verify": "pnpm lint && pnpm typecheck && pnpm format",
1516
"test": "vitest run",
@@ -23,7 +24,8 @@
2324
"db:studio": "drizzle-kit studio",
2425
"auth:generate": "SKIP_ENV_VALIDATION=true pnpm dlx @better-auth/cli generate --output ./src/db/schema/auth.ts",
2526
"email:dev": "email dev --dir ./emails -p 3333",
26-
"email:test": "tsx scripts/test-magic-link.ts"
27+
"email:test": "tsx scripts/test-magic-link.ts",
28+
"prepare": "husky"
2729
},
2830
"dependencies": {
2931
"@hookform/resolvers": "^5.2.2",

src/lib/encryption.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export function decrypt(payload: string): string {
8484
);
8585
decipher.setAuthTag(Buffer.from(authTagHex, "hex"));
8686

87-
return decipher.update(encryptedHex, "hex", "utf8") + decipher.final("utf8");
87+
return (
88+
decipher.update(encryptedHex, "hex", "utf8") + decipher.final("utf8")
89+
);
8890
} catch (error) {
8991
throw new DecryptionError("Failed to decrypt payload", { cause: error });
9092
}

src/lib/middleware/logging.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { RequestLog } from "@/server/services/log-service";
2-
import { sanitizeBody, sanitizeHeaders } from "@/lib/logging-sanitization";
31
import { createMiddleware } from "@modelcontextprotocol/sdk/client/middleware.js";
2+
import { sanitizeBody, sanitizeHeaders } from "@/lib/logging-sanitization";
3+
import type { RequestLog } from "@/server/services/log-service";
44

55
export type LogCallback = (
66
log: Omit<RequestLog, "userId" | "serverId">

0 commit comments

Comments
 (0)