From 43bf1b04ce8c28206a1d6498c7d638bbe7f1fcdf Mon Sep 17 00:00:00 2001 From: Sarthak Agrawal Date: Sun, 23 Aug 2026 14:05:44 +0530 Subject: [PATCH] ci: add a build and lint gate, and record the deployed commit gitstat had no workflows at all despite serving a live Pages deployment, so nothing checked a change before it shipped. Verified locally before adding the gate: `npm run lint` exits 0 and `npm run build` succeeds, so main starts green. `build` is `tsc -b && vite build`, which makes it the typecheck gate too. Also passes --commit-hash on deploy so the live deployment's source SHA is recorded explicitly rather than inferred from the local checkout. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1d7f108 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + workflow_dispatch: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: gitstat-ci-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v6 + with: + node-version: '22' + cache: npm + - run: npm ci --ignore-scripts + - run: npm run lint + # `build` is `tsc -b && vite build`, so this is the typecheck gate too. + - run: npm run build diff --git a/package.json b/package.json index 57c2b37..0dab069 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "build": "tsc -b && vite build", "lint": "oxlint", "preview": "vite preview", - "deploy": "npm run build && wrangler pages deploy dist" + "deploy": "npm run build && wrangler pages deploy dist --project-name gitstat --branch main --commit-hash \"$(git rev-parse HEAD)\"" }, "dependencies": { "react": "^19.2.8",