diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58ffabe..ed04136 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,32 +3,13 @@ name: 🚨 CI Checks on: pull_request: branches: - - '**' + - main + - staging jobs: - check-main-override: - runs-on: ubuntu-latest - steps: - - name: 🛑 Block direct pushes to main (unless override flag) - run: | - echo "🔍 Event: ${{ github.event_name }} | Ref: ${{ github.ref }}" - if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then - COMMIT_MSG="${{ github.event.head_commit.message }}" - echo "🔍 Commit message: $COMMIT_MSG" - if [[ "$COMMIT_MSG" != *"[override-main]"* ]]; then - echo "❌ Direct push to main is blocked. Use a PR or include [override-main] in your commit message." - exit 1 - else - echo "✅ Override flag found. Proceeding." - fi - else - echo "â„šī¸ Not a direct push to main. Proceeding." - fi - lint: name: 🔍 Lint runs-on: ubuntu-latest - needs: check-main-override steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -41,7 +22,6 @@ jobs: typecheck: name: ✅ Type Check runs-on: ubuntu-latest - needs: check-main-override steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -54,7 +34,6 @@ jobs: build: name: 🔨 Build runs-on: ubuntu-latest - needs: check-main-override steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -70,3 +49,10 @@ jobs: restore-keys: | next-${{ runner.os }}- - run: yarn build + + ci: + name: 🚨 CI Checks + runs-on: ubuntu-latest + needs: [lint, typecheck, build] + steps: + - run: echo "✅ All checks completed successfully." diff --git a/README.md b/README.md index 8759cb9..c76783c 100644 --- a/README.md +++ b/README.md @@ -207,10 +207,10 @@ Core styling configuration files: - `yarn lint:fix` - Fix ESLint errors - `yarn format` - Format code with Prettier - `yarn check-format` - Check code formatting +- `yarn typecheck` - Check Typescript types ## CI & Deployments -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/CFsylvester/next.js-tailwind-typescript-TEMPLATE) [![CI Checks](https://github.com/CFsylvester/next.js-tailwind-typescript-TEMPLATE/actions/workflows/ci.yml/badge.svg)](https://github.com/CFsylvester/next.js-tailwind-typescript-TEMPLATE/actions/workflows/ci.yml) This template includes a built-in GitHub Actions workflow (`ci.yml`) that runs automatically on all pull requests and pushes to `main` and `staging`. @@ -220,10 +220,6 @@ This template includes a built-in GitHub Actions workflow (`ci.yml`) that runs a - 🔍 Linting with ESLint - ✅ Type-checking with TypeScript - 🔨 Build verification (`next build`) -- 🛑 Main branch is protected — requires `[override-main]` in commit message to push directly - -> All CI checks must pass before merging into `main` or `staging`. -> Preview deployments are automatically handled by Vercel for all branches and PRs. ---