Skip to content

Commit b0c3877

Browse files
committed
try again
1 parent f9a0f20 commit b0c3877

File tree

1 file changed

+24
-38
lines changed

1 file changed

+24
-38
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,80 +11,66 @@ on:
1111

1212
jobs:
1313
check-main-override:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- name: 🛑 Block direct pushes to main (unless override flag)
17-
run: |
18-
echo "🔍 Checking push context: ${{ github.event_name }} → ${{ github.ref }}"
19-
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
20-
if [[ "${{ github.event.head_commit.message }}" != *"[override-main]"* ]]; then
21-
echo "❌ Direct push to main is blocked. Use a PR or include [override-main] in your commit message."
22-
exit 1
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: 🛑 Block direct pushes to main (unless override flag)
17+
run: |
18+
echo "🔍 Event: ${{ github.event_name }} | Ref: ${{ github.ref }}"
19+
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
20+
COMMIT_MSG="${{ github.event.head_commit.message }}"
21+
echo "🔍 Commit message: $COMMIT_MSG"
22+
if [[ "$COMMIT_MSG" != *"[override-main]"* ]]; then
23+
echo "❌ Direct push to main is blocked. Use a PR or include [override-main] in your commit message."
24+
exit 1
25+
else
26+
echo "✅ Override flag found. Proceeding."
27+
fi
2328
else
24-
echo "✅ Override flag found. Allowing push to main."
29+
echo "ℹ️ Not a direct push to main. Proceeding."
2530
fi
26-
else
27-
echo "ℹ️ Not a direct push to main. Skipping protection."
28-
fi
2931
3032
lint:
3133
name: 🔍 Lint
3234
runs-on: ubuntu-latest
33-
if: github.ref != 'refs/heads/main' || github.event_name != 'push' || needs.check-main-override.result == 'success'
34-
needs: [check-main-override]
35+
needs: check-main-override
3536
steps:
3637
- uses: actions/checkout@v4
3738
- uses: actions/setup-node@v4
3839
with:
3940
node-version: 22
4041
cache: yarn
41-
42-
- name: 📦 Install dependencies
43-
run: yarn install --frozen-lockfile
44-
45-
- name: Run Linter
46-
run: yarn lint
42+
- run: yarn install --frozen-lockfile
43+
- run: yarn lint
4744

4845
typecheck:
4946
name: ✅ Type Check
5047
runs-on: ubuntu-latest
51-
if: github.ref != 'refs/heads/main' || github.event_name != 'push' || needs.check-main-override.result == 'success'
52-
needs: [check-main-override]
48+
needs: check-main-override
5349
steps:
5450
- uses: actions/checkout@v4
5551
- uses: actions/setup-node@v4
5652
with:
5753
node-version: 22
5854
cache: yarn
59-
60-
- name: 📦 Install dependencies
61-
run: yarn install --frozen-lockfile
62-
63-
- name: Run TypeScript
64-
run: yarn typecheck
55+
- run: yarn install --frozen-lockfile
56+
- run: yarn typecheck
6557

6658
build:
6759
name: 🔨 Build
6860
runs-on: ubuntu-latest
69-
if: github.ref != 'refs/heads/main' || github.event_name != 'push' || needs.check-main-override.result == 'success'
70-
needs: [check-main-override]
61+
needs: check-main-override
7162
steps:
7263
- uses: actions/checkout@v4
7364
- uses: actions/setup-node@v4
7465
with:
7566
node-version: 22
7667
cache: yarn
77-
78-
- name: 📦 Install dependencies
79-
run: yarn install --frozen-lockfile
80-
68+
- run: yarn install --frozen-lockfile
8169
- name: ⚡ Cache .next build
8270
uses: actions/cache@v4
8371
with:
8472
path: .next
8573
key: next-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
8674
restore-keys: |
8775
next-${{ runner.os }}-
88-
89-
- name: Build App
90-
run: yarn build
76+
- run: yarn build

0 commit comments

Comments
 (0)