Skip to content

GitHub actions #3

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

Merged
merged 5 commits into from
Jun 16, 2025
Merged
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
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: 🚨 CI Checks

on:
push:
branches:
- main
- staging
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
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
[![Yarn](https://img.shields.io/badge/Yarn->=1.22.0-F7740D?style=flat&logo=yarn)](https://yarnpkg.com/)
[![VS Code](https://img.shields.io/badge/Editor-VS%20Code-666666?style=flat&logo=visual-studio-code)](https://code.visualstudio.com/)

> ⚠️ Direct pushes to `main` are blocked by CI unless the commit message includes `[override-main]`.
> Use Pull Requests into `main`, or merge from `staging`.

## Getting Started

1. Clone the repository:
Expand Down Expand Up @@ -411,26 +414,25 @@ useEffect(() => {
Add the grid system to your server render layout found in `layout.tsx` within the app directory:

```tsx
// check env vars
const devMode = process.env.NODE_ENV === 'development';
const isGridOverlayOverride = process.env.GRID_OVERLAY_OVERRIDE === 'true';

// show grid overlay if dev mode is true or if the grid overlay override is true
const showGridOverlay = devMode || isGridOverlayOverride;

return (
<html lang="en" className={montserrat.variable}>
<body>
{/* DEV GRID TOGGLE */}
{showGridOverlay && <GridOverlayToggle />}

{/* MAIN CONTENT */}
{/* GRID OVERLAY relies on the layout class */}
<main data-grid-overlay className={'layout'}>
{children}
</main>
</body>
</html>
);

// check env vars
const devMode = process.env.NODE_ENV === 'development';
const isGridOverlayOverride = process.env.GRID_OVERLAY_OVERRIDE === 'true';

// show grid overlay if dev mode is true or if the grid overlay override is true
const showGridOverlay = devMode || isGridOverlayOverride;

return (
<html lang="en" className={montserrat.variable}>
<body>
{/* DEV GRID TOGGLE */}
{showGridOverlay && <GridOverlayToggle />}

{/* MAIN CONTENT */}
{/* GRID OVERLAY relies on the layout class */}
<main data-grid-overlay className={'layout'}>
{children}
</main>
</body>
</html>
);
```
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"lint": "next lint",
"lint:fix": "next lint --fix",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\"",
"check-format": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
"check-format": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\"",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"change-case": "^5.4.4",
Expand Down