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.

chore(ci): skip non-required image pushes on merge queue branches (#85967)

Georges-Antoine Assi3b8525ebe903
diff --git a/.github/workflows/ci-ml-mirror-image-scrub-container.yml b/.github/workflows/ci-ml-mirror-image-scrub-container.yml
index 96d8d1e864f9..20252fe3dcaa 100644
--- a/.github/workflows/ci-ml-mirror-image-scrub-container.yml
+++ b/.github/workflows/ci-ml-mirror-image-scrub-container.yml
@@ -82,10 +82,13 @@ jobs:
build:
needs: changes
name: Build and push ml-mirror-image-scrub image
+ # Skipped on trunk-merge/** branches: merge-queue PRs are ephemeral, nothing
+ # pulls images pushed for them, and each constituent PR already built its own.
if: |
- (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.changes.outputs.scrub_files == 'true') ||
- (github.event_name == 'workflow_dispatch' && github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true') ||
- (github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.changes.outputs.scrub_files == 'true' && github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true')
+ !startsWith(github.head_ref, 'trunk-merge/') &&
+ ((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.changes.outputs.scrub_files == 'true') ||
+ (github.event_name == 'workflow_dispatch' && github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true') ||
+ (github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.changes.outputs.scrub_files == 'true' && github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true'))
runs-on: depot-ubuntu-24.04
timeout-minutes: 30
permissions:
diff --git a/.github/workflows/ci-nodejs-container.yml b/.github/workflows/ci-nodejs-container.yml
index c7143bb27af0..2adc8719bbe2 100644
--- a/.github/workflows/ci-nodejs-container.yml
+++ b/.github/workflows/ci-nodejs-container.yml
@@ -35,7 +35,9 @@ jobs:
contents: read
pull-requests: read
timeout-minutes: 5
- if: github.repository_owner == 'PostHog'
+ # Skipped on trunk-merge/** branches: merge-queue PRs are ephemeral, nothing
+ # pulls images pushed for them, and each constituent PR already built its own.
+ if: github.repository_owner == 'PostHog' && !startsWith(github.head_ref, 'trunk-merge/')
name: Determine need to run node Docker build
outputs:
node_files: ${{ steps.filter.outputs.node_files }}
diff --git a/.github/workflows/livestream-docker-image.yml b/.github/workflows/livestream-docker-image.yml
index 1db04001f937..0f3f98956c27 100644
--- a/.github/workflows/livestream-docker-image.yml
+++ b/.github/workflows/livestream-docker-image.yml
@@ -23,7 +23,9 @@ jobs:
runs-on: depot-ubuntu-24.04
timeout-minutes: 10
- if: github.repository_owner == 'PostHog'
+ # Skipped on trunk-merge/** branches: merge-queue PRs are ephemeral, nothing
+ # pulls images pushed for them, and each constituent PR already built its own.
+ if: github.repository_owner == 'PostHog' && !startsWith(github.head_ref, 'trunk-merge/')
permissions:
contents: read
diff --git a/.github/workflows/rust-docker-build.yml b/.github/workflows/rust-docker-build.yml
index 4f6648292143..9103d2b7a913 100644
--- a/.github/workflows/rust-docker-build.yml
+++ b/.github/workflows/rust-docker-build.yml
@@ -39,8 +39,11 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
# Skip on workflow_dispatch — always build everything (escape hatch)
+ # Skipped on trunk-merge/** branches: merge-queue PRs are ephemeral, nothing
+ # pulls images pushed for them, and each constituent PR already built its own.
if: >-
github.event_name != 'workflow_dispatch' &&
+ !startsWith(github.head_ref, 'trunk-merge/') &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
permissions:
@@ -78,8 +81,11 @@ jobs:
# and a skipped need would otherwise cascade a skip here. !cancelled() covers that
# while still stopping the build after manual workflow cancellation.
# Run unless affected explicitly found zero images ('none') or failed.
+ # The trunk-merge guard is repeated here because a skipped 'affected' leaves
+ # image-filter empty, which this condition would otherwise treat as buildable.
if: |
!cancelled() &&
+ !startsWith(github.head_ref, 'trunk-merge/') &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository) &&
needs.affected.result != 'failure' &&