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): only build PR images for pull requests on PostHog/posthog (#118068)

Georges-Antoine Assi369bce77ecb0
diff --git a/.github/workflows/cd-sandbox-base-image.yml b/.github/workflows/cd-sandbox-base-image.yml
index c7a80c25df81..d335ee9e997c 100644
--- a/.github/workflows/cd-sandbox-base-image.yml
+++ b/.github/workflows/cd-sandbox-base-image.yml
@@ -42,7 +42,7 @@ jobs:
if: |
github.repository_owner == 'PostHog' &&
!startsWith(github.head_ref, 'trunk-merge/') &&
- (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
+ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'PostHog/posthog')
name: Determine if sandbox image needs to be built
permissions:
contents: read
@@ -64,7 +64,7 @@ jobs:
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: app-token
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'PostHog/posthog'
with:
client-id: ${{ vars.GH_APP_POSTHOG_PATHS_FILTER_APP_ID }}
private-key: ${{ secrets.GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY }}
@@ -210,7 +210,7 @@ jobs:
name: Wait for the pinned agent to be published
if: |
github.repository_owner == 'PostHog' &&
- (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && (
+ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'PostHog/posthog') && (
needs.changes.outputs.sandbox_image == 'true' ||
github.event_name == 'workflow_dispatch' ||
contains(github.event.pull_request.labels.*.name, 'build-tasks-sandbox-image')
@@ -255,7 +255,7 @@ jobs:
name: Build agent skills from source
if: |
github.repository_owner == 'PostHog' &&
- (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
+ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'PostHog/posthog') &&
(github.event_name != 'pull_request' || needs.changes.outputs.skills_source == 'true') && (
needs.changes.outputs.sandbox_image == 'true' ||
github.event_name == 'workflow_dispatch' ||
@@ -467,7 +467,7 @@ jobs:
if: |
github.repository_owner == 'PostHog' &&
github.event_name == 'pull_request' &&
- github.event.pull_request.head.repo.full_name == github.repository &&
+ github.event.pull_request.head.repo.full_name == 'PostHog/posthog' &&
needs.changes.outputs.skills_source != 'true' && (
needs.changes.outputs.sandbox_image == 'true' ||
contains(github.event.pull_request.labels.*.name, 'build-tasks-sandbox-image')
@@ -519,7 +519,7 @@ jobs:
if: |
!cancelled() &&
github.repository_owner == 'PostHog' &&
- (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
+ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'PostHog/posthog') &&
(needs.build_skills.result == 'success' || needs.fetch_skills.result == 'success') &&
needs.wait_for_agent.result == 'success' && (
needs.changes.outputs.sandbox_image == 'true' ||
@@ -676,7 +676,7 @@ jobs:
if: |
!cancelled() &&
github.repository_owner == 'PostHog' &&
- (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
+ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'PostHog/posthog') &&
needs.sandbox_base_build.result == 'success' &&
(github.ref != 'refs/heads/master' || needs.sandbox_base_build.outputs.promoted == 'success') && (
needs.changes.outputs.sandbox_image == 'true' ||
diff --git a/.github/workflows/ci-ml-mirror-image-scrub-container.yml b/.github/workflows/ci-ml-mirror-image-scrub-container.yml
index 2e8bb012cd9b..fbbe30ea0c69 100644
--- a/.github/workflows/ci-ml-mirror-image-scrub-container.yml
+++ b/.github/workflows/ci-ml-mirror-image-scrub-container.yml
@@ -31,7 +31,7 @@ jobs:
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: app-token
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'PostHog/posthog'
with:
client-id: ${{ vars.GH_APP_POSTHOG_PATHS_FILTER_APP_ID }}
private-key: ${{ secrets.GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY }}
@@ -54,7 +54,7 @@ jobs:
test:
needs: changes
name: Unit-test ml-mirror-image-scrub
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.changes.outputs.scrub_files == 'true'
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'PostHog/posthog' && needs.changes.outputs.scrub_files == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
@@ -104,7 +104,7 @@ jobs:
# pulls images pushed for them, and each constituent PR already built its own.
if: |
!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 == 'pull_request' && github.event.pull_request.head.repo.full_name == 'PostHog/posthog' && 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
diff --git a/.github/workflows/ci-nodejs-container.yml b/.github/workflows/ci-nodejs-container.yml
index 9544218d1052..c48e231899a0 100644
--- a/.github/workflows/ci-nodejs-container.yml
+++ b/.github/workflows/ci-nodejs-container.yml
@@ -51,7 +51,7 @@ jobs:
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: app-token
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'PostHog/posthog'
with:
client-id: ${{ vars.GH_APP_POSTHOG_PATHS_FILTER_APP_ID }}
private-key: ${{ secrets.GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY }}
@@ -104,7 +104,7 @@ jobs:
needs: changes
name: Build and push node image
if: |
- (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.changes.outputs.node_files == 'true') ||
+ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'PostHog/posthog' && needs.changes.outputs.node_files == 'true') ||
(github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.changes.outputs.node_files == 'true' && github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true')
runs-on: depot-ubuntu-24.04
timeout-minutes: 30
diff --git a/.github/workflows/ci-recording-rasterizer-container.yml b/.github/workflows/ci-recording-rasterizer-container.yml
index d4ee91d54088..e5d75623f1b8 100644
--- a/.github/workflows/ci-recording-rasterizer-container.yml
+++ b/.github/workflows/ci-recording-rasterizer-container.yml
@@ -55,7 +55,7 @@ jobs:
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
id: app-token
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
+ if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'PostHog/posthog'
with:
client-id: ${{ vars.GH_APP_POSTHOG_PATHS_FILTER_APP_ID }}
private-key: ${{ secrets.GH_APP_POSTHOG_PATHS_FILTER_PRIVATE_KEY }}
@@ -86,7 +86,7 @@ jobs:
needs: changes
name: Build and push recording-rasterizer image
if: |
- (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.changes.outputs.rasterizer_files == 'true') ||
+ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'PostHog/posthog' && needs.changes.outputs.rasterizer_files == 'true') ||
(github.event_name == 'workflow_dispatch' && github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true') ||
(github.event_name == 'schedule' && github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true') ||
(github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.changes.outputs.rasterizer_files == 'true' && github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true')
diff --git a/.github/workflows/livestream-docker-image.yml b/.github/workflows/livestream-docker-image.yml
index 447514a16c9e..828d23fbf9c9 100644
--- a/.github/workflows/livestream-docker-image.yml
+++ b/.github/workflows/livestream-docker-image.yml
@@ -25,7 +25,7 @@ jobs:
# 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/')
+ if: github.repository_owner == 'PostHog' && !startsWith(github.head_ref, 'trunk-merge/') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'PostHog/posthog')
permissions:
contents: read
diff --git a/.github/workflows/rust-docker-build.yml b/.github/workflows/rust-docker-build.yml
index 00ae99e11fcc..8b3c5b8b93a2 100644
--- a/.github/workflows/rust-docker-build.yml
+++ b/.github/workflows/rust-docker-build.yml
@@ -51,7 +51,7 @@ jobs:
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)
+ github.event.pull_request.head.repo.full_name == 'PostHog/posthog')
permissions:
contents: read
outputs:
@@ -93,7 +93,7 @@ jobs:
!cancelled() &&
!startsWith(github.head_ref, 'trunk-merge/') &&
(github.event_name != 'pull_request' ||
- github.event.pull_request.head.repo.full_name == github.repository) &&
+ github.event.pull_request.head.repo.full_name == 'PostHog/posthog') &&
needs.affected.result != 'failure' &&
needs.affected.outputs.image-filter != 'none'
uses: ./.github/workflows/_rust-build-images.yml