Staging #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🚨 CI Checks | |
on: | |
pull_request: | |
branches: | |
- '**' | |
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 | |
with: | |
node-version: 22 | |
cache: yarn | |
- run: yarn install --frozen-lockfile | |
- run: yarn lint | |
typecheck: | |
name: ✅ Type Check | |
runs-on: ubuntu-latest | |
needs: check-main-override | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: yarn | |
- run: yarn install --frozen-lockfile | |
- run: yarn typecheck | |
build: | |
name: 🔨 Build | |
runs-on: ubuntu-latest | |
needs: check-main-override | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: yarn | |
- run: yarn install --frozen-lockfile | |
- name: ⚡ Cache .next build | |
uses: actions/cache@v4 | |
with: | |
path: .next | |
key: next-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
next-${{ runner.os }}- | |
- run: yarn build |