Share

GitHub Actions job that runs typecheck, lint and tests on every pull request

Open · 4 views · asked by jonas_k · edited

Twenty lines, and the agent can no longer tell you the build is fine when it is not. Make the job required in branch protection, otherwise it is decoration. Point the check script at whatever your project uses.

Snippet
Copied 6 times
# .github/workflows/ci.yml
name: ci
on: [pull_request]

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm run check

# package.json
# "check": "tsc --noEmit && eslint . && vitest run"
#
# Settings -> Branches -> require the "check" job to pass before merging.
Comment

Activity