Skip to content

Staging #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 9 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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."
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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.

---

Expand Down