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): ignore unrelated labels in docker and hobby CI (#98607)

Raúl Negrón-Otero95545c9ac94a
diff --git a/.github/workflows/ci-hobby.yml b/.github/workflows/ci-hobby.yml
index 327282496e6d..1569c2aa60ce 100644
--- a/.github/workflows/ci-hobby.yml
+++ b/.github/workflows/ci-hobby.yml
@@ -20,7 +20,18 @@ on:
types: [opened, synchronize, labeled, unlabeled]
concurrency:
- group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
+ # Keep unrelated labels out of the group that owns active smoke tests and previews.
+ group: >-
+ ${{ github.workflow }}-${{
+ contains(fromJSON('["labeled", "unlabeled"]'), github.event.action)
+ && !(
+ (github.event.action == 'labeled'
+ && contains(fromJSON('["hobby-preview", "no-depot-docker-cache"]'), github.event.label.name))
+ || (github.event.action == 'unlabeled' && github.event.label.name == 'hobby-preview')
+ )
+ && format('ignored-label-{0}', github.event.label.name)
+ || github.head_ref || github.ref
+ }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
@@ -36,7 +47,13 @@ jobs:
timeout-minutes: 5
# trunk-merge/** heads are skipped: merge-queue PRs are ephemeral and every
# constituent PR already ran this in full.
- if: github.event_name == 'pull_request' && !startsWith(github.head_ref, 'trunk-merge/')
+ if: >-
+ github.event_name == 'pull_request'
+ && !startsWith(github.head_ref, 'trunk-merge/')
+ && (!contains(fromJSON('["labeled", "unlabeled"]'), github.event.action)
+ || (github.event.action == 'labeled'
+ && contains(fromJSON('["hobby-preview", "no-depot-docker-cache"]'), github.event.label.name))
+ || (github.event.action == 'unlabeled' && github.event.label.name == 'hobby-preview'))
name: Determine need to run hobby checks
outputs:
should_run: ${{ steps.filter.outputs.hobby == 'true' || steps.check-label.outputs.has_label == 'true' }}
@@ -203,7 +220,11 @@ jobs:
id: wait-for-image
with:
token: ${{ secrets.GITHUB_TOKEN }}
- checkName: Build Docker image
+ checkName: >-
+ ${{ github.event.action == 'labeled'
+ && contains(fromJSON('["hobby-preview", "no-depot-docker-cache"]'), github.event.label.name)
+ && 'Build labeled Docker image'
+ || 'Build Docker image' }}
ref: ${{ github.event.pull_request.head.sha }}
timeoutSeconds: '3600'
intervalSeconds: '30'
diff --git a/.github/workflows/container-images-ci.yml b/.github/workflows/container-images-ci.yml
index e0f25e49eaf3..4fdaf826b433 100644
--- a/.github/workflows/container-images-ci.yml
+++ b/.github/workflows/container-images-ci.yml
@@ -2,10 +2,9 @@ name: Container Images CI
on:
pull_request:
- # Mirror ci-hobby.yml's trigger types so the `hobby-preview` label can
- # retroactively kick off a build. ci-hobby.yml omits `reopened`, so we
- # do too — otherwise reopens would build an image with no consumer.
- types: [opened, synchronize, labeled, unlabeled]
+ # Label-triggered builds live in container-images-label-ci.yml so a skipped
+ # label event cannot replace this workflow's required check.
+ types: [opened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
@@ -88,6 +87,7 @@ jobs:
# edit leaves the lockfile untouched.
build_inputs:
- .github/workflows/container-images-ci.yml
+ - .github/workflows/container-images-label-ci.yml
- .github/actions/build-n-cache-image/**
- .dockerignore
- pnpm-lock.yaml
diff --git a/.github/workflows/container-images-label-ci.yml b/.github/workflows/container-images-label-ci.yml
new file mode 100644
index 000000000000..625a792d7c94
--- /dev/null
+++ b/.github/workflows/container-images-label-ci.yml
@@ -0,0 +1,43 @@
+name: Container image label build
+
+on:
+ pull_request:
+ types: [labeled]
+
+concurrency:
+ # An unrelated label must not cancel a preview or uncached build already in progress.
+ group: >-
+ ${{ github.workflow }}-${{
+ !contains(fromJSON('["hobby-preview", "no-depot-docker-cache"]'), github.event.label.name)
+ && format('ignored-label-{0}', github.event.label.name)
+ || github.head_ref || github.ref
+ }}
+ cancel-in-progress: true
+
+jobs:
+ posthog-build:
+ # This check is intentionally distinct from the required `Build Docker image`
+ # context, which only container-images-ci.yml can publish.
+ name: Build labeled Docker image
+ if: >-
+ github.event.pull_request.head.repo.full_name == github.repository
+ && contains(fromJSON('["hobby-preview", "no-depot-docker-cache"]'), github.event.label.name)
+ runs-on: depot-ubuntu-24.04-4
+ timeout-minutes: 30
+ permissions:
+ id-token: write
+ contents: read
+ steps:
+ - name: Check out
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+
+ - name: Build and cache Docker image in Depot
+ uses: ./.github/actions/build-n-cache-image
+ with:
+ actions-id-token-request-url: ${{ env.ACTIONS_ID_TOKEN_REQUEST_URL }}
+ push-image: true
+ aws-role-to-assume: ${{ vars.AWS_ECR_POSTHOG_PRS_PUBLISH_IAM_ROLE }}
+ dockerhub-username: ${{ secrets.DOCKERHUB_USER }}
+ dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
+ pr-number: ${{ github.event.number }}
+ no-cache: ${{ contains(github.event.pull_request.labels.*.name, 'no-depot-docker-cache') }}
diff --git a/docs/internal/ci-things-already-tried.md b/docs/internal/ci-things-already-tried.md
index 1176b35da2e8..4d66f64e5138 100644
--- a/docs/internal/ci-things-already-tried.md
+++ b/docs/internal/ci-things-already-tried.md
@@ -362,6 +362,9 @@ _Also asked as:_ Docker Hub rate limit in CI, unauthenticated pull limit, DOCKER
## CI orchestration
+The required Docker image workflow runs only when a pull request opens or changes.
+A separate non-required workflow handles `hobby-preview` and `no-depot-docker-cache` label additions, while Hobby label events still handle preview cleanup.
+
### Move CI from the Depot runners to Blacksmith
**Verdict: rejected** · Apr 2026 to May 2026 · [#54559](https://github.com/PostHog/posthog/pull/54559), removed by [#57991](https://github.com/PostHog/posthog/pull/57991)