Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ci): run the full suites on trunk merge-queue branches (#74367)

Georges-Antoine Assi377daf210294
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index 21eb98fa86d3..43a14e3d1eeb 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -200,6 +200,7 @@ jobs:
needs.sample.outputs.sampled == 'true'
&& (github.event_name != 'pull_request'
|| github.event.pull_request.draft != true
+ || startsWith(github.head_ref, 'trunk-merge/')
|| !contains(github.event.pull_request.labels.*.name, 'no-ci'))
runs-on: depot-ubuntu-24.04
timeout-minutes: 5
@@ -562,9 +563,12 @@ jobs:
# which build_django_matrix falls back to
# when select-tests is skipped (empty MODE). The run-ci-backend label
# forces the full matrices on a draft.
+ # Trunk's merge-queue branches open as draft PRs, but their run IS the
+ # merge gate, so they must never get the narrowed selection.
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.draft == true &&
+ !startsWith(github.head_ref, 'trunk-merge/') &&
!contains(github.event.pull_request.labels.*.name, 'run-ci-backend') &&
needs.changes.outputs.backend == 'true'
runs-on: depot-ubuntu-24.04
@@ -775,7 +779,7 @@ jobs:
turbo-tests:
needs: [changes, turbo-discover, detect-snapshot-mode, build-product-test-matrix, get_clickhouse_versions]
if: >-
- !cancelled() && (github.event.pull_request.draft != true || contains(github.event.pull_request.labels.*.name, 'run-ci-backend')) && needs.turbo-discover.result == 'success' && needs.build-product-test-matrix.result == 'success' && needs.build-product-test-matrix.outputs.include != '[]' && needs.build-product-test-matrix.outputs.include != ''
+ !cancelled() && (github.event.pull_request.draft != true || startsWith(github.head_ref, 'trunk-merge/') || contains(github.event.pull_request.labels.*.name, 'run-ci-backend')) && needs.turbo-discover.result == 'success' && needs.build-product-test-matrix.result == 'success' && needs.build-product-test-matrix.outputs.include != '[]' && needs.build-product-test-matrix.outputs.include != ''
runs-on: depot-ubuntu-24.04
timeout-minutes: 40
name: Product tests (${{ matrix.group }}, events schema ${{ matrix.new-events-schema && 'json' || 'legacy' }})
@@ -1278,7 +1282,13 @@ jobs:
RUN_POE: ${{ needs.select-tests.outputs.run_poe }}
RUN_TEMPORAL: ${{ needs.select-tests.outputs.run_temporal }}
CORE_FILES: ${{ needs.select-tests.outputs.core_files }}
- IS_DRAFT: ${{ github.event.pull_request.draft }}
+ # A trunk-merge/** PR opens as a draft but is the merge gate, and
+ # select-tests deliberately does not run for it. Reporting it as a
+ # draft here would turn that empty MODE into "skip" and build an
+ # empty matrix, so the queue would merge having run no Django tests
+ # at all. Not-draft makes the empty MODE fall through to the full
+ # matrix, which is what the queue has to run.
+ IS_DRAFT: ${{ github.event.pull_request.draft && !startsWith(github.head_ref, 'trunk-merge/') }}
FORCE_FULL: ${{ contains(github.event.pull_request.labels.*.name, 'run-ci-backend') }}
run: |
# :NOTE: Keep shard counts/group ranges in sync with historical Django matrix tuning.
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index 828f4dd52522..32702aafd302 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -87,6 +87,7 @@ jobs:
if: >-
github.event_name != 'pull_request'
|| github.event.pull_request.draft != true
+ || startsWith(github.head_ref, 'trunk-merge/')
|| !contains(github.event.pull_request.labels.*.name, 'no-ci')
name: Determine need to run backend and migration checks
# Set job outputs to values from filter step
@@ -516,9 +517,12 @@ jobs:
# which build_django_matrix falls back to
# when select-tests is skipped (empty MODE). The run-ci-backend label
# forces the full matrices on a draft.
+ # Trunk's merge-queue branches open as draft PRs, but their run IS the
+ # merge gate, so they must never get the narrowed selection.
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.draft == true &&
+ !startsWith(github.head_ref, 'trunk-merge/') &&
!contains(github.event.pull_request.labels.*.name, 'run-ci-backend') &&
needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
@@ -753,6 +757,7 @@ jobs:
if: >-
!cancelled() &&
(github.event.pull_request.draft != true ||
+ startsWith(github.head_ref, 'trunk-merge/') ||
contains(github.event.pull_request.labels.*.name, 'run-ci-backend')) &&
needs.turbo-discover.result == 'success' &&
needs.build-product-test-matrix.result == 'success' &&
@@ -2174,7 +2179,13 @@ jobs:
RUN_POE: ${{ needs.select-tests.outputs.run_poe }}
RUN_TEMPORAL: ${{ needs.select-tests.outputs.run_temporal }}
CORE_FILES: ${{ needs.select-tests.outputs.core_files }}
- IS_DRAFT: ${{ github.event.pull_request.draft }}
+ # A trunk-merge/** PR opens as a draft but is the merge gate, and
+ # select-tests deliberately does not run for it. Reporting it as a
+ # draft here would turn that empty MODE into "skip" and build an
+ # empty matrix, so the queue would merge having run no Django tests
+ # at all. Not-draft makes the empty MODE fall through to the full
+ # matrix, which is what the queue has to run.
+ IS_DRAFT: ${{ github.event.pull_request.draft && !startsWith(github.head_ref, 'trunk-merge/') }}
FORCE_FULL: ${{ contains(github.event.pull_request.labels.*.name, 'run-ci-backend') }}
# The new-events-schema variants double the matrix, so they only run on
# PRs opted in via the test-new-events-schema label and on manual dispatch.
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.yml
index ab8ce97166cf..eaab056c5919 100644
--- a/.github/workflows/ci-e2e-playwright.yml
+++ b/.github/workflows/ci-e2e-playwright.yml
@@ -83,7 +83,8 @@ jobs:
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.head.repo.full_name == github.repository &&
- github.event.pull_request.draft != true)
+ (github.event.pull_request.draft != true ||
+ startsWith(github.head_ref, 'trunk-merge/')))
name: Determine need to run E2E checks
outputs:
# Debounce can veto a PR run whose SHA has already been superseded (see below).
diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.yml
index 5e14226c9722..17962660efb7 100644
--- a/.github/workflows/ci-frontend.yml
+++ b/.github/workflows/ci-frontend.yml
@@ -39,6 +39,7 @@ jobs:
if: >-
github.event_name != 'pull_request'
|| github.event.pull_request.draft != true
+ || startsWith(github.head_ref, 'trunk-merge/')
|| !contains(github.event.pull_request.labels.*.name, 'no-ci')
name: Determine need to run frontend checks
# A snapshot-only bot push (Visual Review auto-commits frontend/snapshots.yml after
@@ -181,10 +182,13 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: changes
+ # Trunk's merge-queue branches open as draft PRs, but their run IS the
+ # merge gate, so they must never get the narrowed selection.
if: |
!cancelled() && needs.changes.outputs.frontend_code == 'true'
&& github.event_name == 'pull_request'
&& github.event.pull_request.draft == true
+ && !startsWith(github.head_ref, 'trunk-merge/')
&& !contains(github.event.pull_request.labels.*.name, 'run-ci-frontend')
outputs:
mode: ${{ steps.classify.outputs.mode }}
diff --git a/.github/workflows/ci-mcp.yml b/.github/workflows/ci-mcp.yml
index dbe453001d70..5597d17390af 100644
--- a/.github/workflows/ci-mcp.yml
+++ b/.github/workflows/ci-mcp.yml
@@ -32,6 +32,7 @@ jobs:
if: >-
github.event_name != 'pull_request'
|| github.event.pull_request.draft != true
+ || startsWith(github.head_ref, 'trunk-merge/')
|| !contains(github.event.pull_request.labels.*.name, 'no-ci')
name: Determine need to run MCP checks
outputs:
@@ -253,7 +254,7 @@ jobs:
# Python change, so they're the expensive half of this workflow. Build and
# unit tests still run on drafts; the `MCP Tests Pass` aggregator treats
# skipped as success, and the ready-for-review run is the merge gate.
- if: needs.changes.outputs.mcp == 'true' && github.event.pull_request.draft != true
+ if: needs.changes.outputs.mcp == 'true' && (github.event.pull_request.draft != true || startsWith(github.head_ref, 'trunk-merge/'))
env:
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.yml
index e8bd0d14e144..8e5436ba7bc4 100644
--- a/.github/workflows/ci-storybook.yml
+++ b/.github/workflows/ci-storybook.yml
@@ -32,6 +32,7 @@ jobs:
if: >-
github.event_name != 'pull_request'
|| github.event.pull_request.draft != true
+ || startsWith(github.head_ref, 'trunk-merge/')
|| !contains(github.event.pull_request.labels.*.name, 'no-ci')
name: Determine need to run storybook checks
# Set job outputs to values from filter step
@@ -810,10 +811,13 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [changes, build-storybook]
+ # Trunk's merge-queue branches open as draft PRs, but their run IS the
+ # merge gate, so they must never get the narrowed selection.
if: |
!cancelled() && needs.changes.outputs.frontend == 'true'
&& github.event_name == 'pull_request'
&& github.event.pull_request.draft == true
+ && !startsWith(github.head_ref, 'trunk-merge/')
&& !contains(github.event.pull_request.labels.*.name, 'run-ci-frontend')
outputs:
mode: ${{ steps.classify.outputs.mode }}
diff --git a/.github/workflows/pr-housekeeping.yml b/.github/workflows/pr-housekeeping.yml
index 4e566855069b..e2f11f171f0e 100644
--- a/.github/workflows/pr-housekeeping.yml
+++ b/.github/workflows/pr-housekeeping.yml
@@ -22,7 +22,11 @@ permissions:
jobs:
lint-pr:
- if: contains(fromJSON('["opened", "edited", "synchronize"]'), github.event.action)
+ # The merge queue opens its own PR per batch, titled after the branch
+ # (trunk-merge/pr-70624/<uuid>), which can never satisfy Conventional
+ # Commits. The title that matters was already validated on the PR being
+ # queued, so checking the queue's copy only fails its run.
+ if: contains(fromJSON('["opened", "edited", "synchronize"]'), github.event.action) && !startsWith(github.head_ref, 'trunk-merge/')
uses: ./.github/workflows/pr-updated.yml
turbo: