Skip to content

Commit 9fe0b4d

Browse files
committed
ci: skip duplicate CI runs and remove client from Supabase prestart (#497)
# Add CI optimization to skip duplicate runs This PR adds a new pre-job step to our CI workflow that skips duplicate runs when the tree content has already passed CI. This is particularly useful for Graphite rebases with no code changes. The implementation uses the `fkirc/skip-duplicate-actions@v5` action to detect duplicate runs, and all subsequent jobs now depend on this pre-job check with a condition to skip if the pre-job indicates the run is a duplicate. Additionally, the PR removes "client" from the Supabase pre-start script parameters in the build-and-test job.
1 parent e1e9332 commit 9fe0b4d

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,22 @@ permissions:
1414
deployments: write # Netlify action needs it
1515

1616
jobs:
17+
# ─────────────────────────────────────── SKIP DUPLICATE RUNS ──────────────────────────────────────
18+
# Skip CI when tree content already passed (e.g., Graphite rebase with no code changes)
19+
pre_job:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
23+
steps:
24+
- id: skip_check
25+
uses: fkirc/skip-duplicate-actions@v5
26+
with:
27+
skip_after_successful_duplicate: 'true'
28+
1729
# ─────────────────────────────────────── 0. VALIDATE CHANGESETS ──────────────────────────────────────
1830
validate-changesets:
31+
needs: pre_job
32+
if: needs.pre_job.outputs.should_skip != 'true'
1933
runs-on: ubuntu-latest
2034
steps:
2135
- uses: actions/checkout@v4
@@ -45,6 +59,8 @@ jobs:
4559
4660
# ─────────────────────────────────────── 1. BUILD & TEST ──────────────────────────────────────
4761
build-and-test:
62+
needs: pre_job
63+
if: needs.pre_job.outputs.should_skip != 'true'
4864
runs-on: ubuntu-latest
4965
env:
5066
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
@@ -64,7 +80,7 @@ jobs:
6480
echo "NX_HEAD=HEAD" >> $GITHUB_ENV
6581
6682
- name: Pre-start Supabase for affected packages
67-
run: ./scripts/ci-prestart-supabase.sh core client
83+
run: ./scripts/ci-prestart-supabase.sh core
6884

6985
- name: Quality gate (lint + typecheck + test)
7086
run: pnpm nx affected -t lint typecheck test --parallel --configuration=production --base="$NX_BASE" --head="$NX_HEAD"
@@ -77,6 +93,8 @@ jobs:
7793

7894
# ─────────────────────────────────────── 2. EDGE-WORKER E2E ──────────────────────────────────────
7995
edge-worker-e2e:
96+
needs: pre_job
97+
if: needs.pre_job.outputs.should_skip != 'true'
8098
runs-on: ubuntu-latest
8199
env:
82100
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
@@ -111,6 +129,8 @@ jobs:
111129

112130
# ─────────────────────────────────────── 2b. CLI E2E ──────────────────────────────────────
113131
cli-e2e:
132+
needs: pre_job
133+
if: needs.pre_job.outputs.should_skip != 'true'
114134
runs-on: ubuntu-latest
115135
env:
116136
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
@@ -145,6 +165,8 @@ jobs:
145165

146166
# ─────────────────────────────────────── 2c. CLIENT E2E ──────────────────────────────────────
147167
client-e2e:
168+
needs: pre_job
169+
if: needs.pre_job.outputs.should_skip != 'true'
148170
runs-on: ubuntu-latest
149171
env:
150172
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
@@ -179,6 +201,8 @@ jobs:
179201

180202
# ─────────────────────────────────────── 2d. CORE PGTAP ──────────────────────────────────────
181203
core-pgtap:
204+
needs: pre_job
205+
if: needs.pre_job.outputs.should_skip != 'true'
182206
runs-on: ubuntu-latest
183207
env:
184208
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

0 commit comments

Comments
 (0)