: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(ci): let fork prs hit the schema cache (#79046)
Raúl Negrón-Otero5bbee3606a65
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.ymlindex e4b292859d74..3683f2ca0301 100644--- a/.depot/workflows/ci-backend.yml+++ b/.depot/workflows/ci-backend.yml@@ -40,6 +40,12 @@# plumbing such as dual-project tokens, the JUnit-artifact download pattern, re-run attempt# handling — including the attempt-suffixed junit artifact names canonical uploads so the# reporter can pair re-run recoveries with attempt-1 failures) need no depot bump.+# - mirror-schema-cache: canonical's master run copies the migrated schema dump out of the+# migrated-schema artifact into GitHub Actions Cache, so fork PRs (which run without+# secrets and cannot authenticate to Depot Cache) prime instead of migrating from scratch.+# The shadow strips artifact uploads (above) and routes every cache write to Depot Cache+# (below), so it has neither the artifact to download nor a GitHub cache to fill: the job,+# and the check-migrations mig_schema_key output that feeds it, are depot-exempt.# - OpenAPI types: the check-openapi-types job is folded into check-migrations as a# check-only step (drift still fails the run); only its auto-commit side effect is dropped# - events_json variants: the shadow never doubles the matrix (no RUN_NEW_EVENTS_SCHEMAdiff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.ymlindex 6f5d01ba954e..77b019529326 100644--- a/.github/workflows/ci-backend.yml+++ b/.github/workflows/ci-backend.yml@@ -1335,6 +1335,8 @@ jobs:needs: [changes]if: needs.changes.outputs.backend == 'true' || needs.changes.outputs.migrations == 'true' || needs.changes.outputs.persons_sql == 'true'timeout-minutes: 20+ outputs:+ mig_schema_key: ${{ steps.mig-schema-key.outputs.key }}# The "Publish Migration risk check" step posts the check via the# posthog-tests app token, which carries its own checks:write# installation permission — so the check lands in that app's own@@ -1976,6 +1978,37 @@ jobs:echo "Skipping CH migration section — script not present on this checkout"fi+ mirror-schema-cache:+ needs: [check-migrations]+ # Fork PRs run without secrets, so they aren't authenticated to Depot Cache and+ # read only GitHub's own cache, where check-migrations' Depot-runner saves never land.+ # Mirror the dump there so fork PRs prime instead of migrating from scratch.+ if: github.event_name == 'push' && github.ref == 'refs/heads/master'+ name: Mirror schema cache to GitHub cache+ runs-on: ubuntu-latest+ timeout-minutes: 5+ permissions:+ contents: read+ steps:+ - name: Download migrated schema artifact+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ name: migrated-schema++ - name: Save schema to GitHub cache (merge-base key)+ if: github.ref == 'refs/heads/master'+ uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: schema.sql.gz+ key: posthog-schema-master-${{ github.sha }}++ - name: Save schema to GitHub cache (migration-set key)+ if: github.ref == 'refs/heads/master' && needs.check-migrations.outputs.mig_schema_key != ''+ uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: schema.sql.gz+ key: ${{ needs.check-migrations.outputs.mig_schema_key }}+check-openapi-types:needs: [changes]if: needs.changes.outputs.backend == 'true' || needs.changes.outputs.openapi_types == 'true'diff --git a/.github/workflows/ci-mcp.yml b/.github/workflows/ci-mcp.ymlindex 3c4e5df0cf88..4b2179bd3193 100644--- a/.github/workflows/ci-mcp.yml+++ b/.github/workflows/ci-mcp.yml@@ -295,7 +295,8 @@ jobs:name: Integration Tests (depot-ubuntu-24.04-4)runs-on: depot-ubuntu-24.04-4needs: changes- timeout-minutes: 30+ # Sized for a schema-cache miss (full migrate from scratch), not just a hit.+ timeout-minutes: 45# Skipped on drafts: these boot the full PostHog backend and trigger on any# non-pytest Python change, so they're the expensive half of this workflow.# Build and unit tests still run on drafts; the `MCP Tests Pass` aggregator