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): upload backend and playwright junit to trunk (#67433)

Paul D'Ambra6ffc519d6aed
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index f431ed33861e..c03ee5ad0708 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -14,7 +14,9 @@
# - permissions: pull-requests:read (no comment/auto-commit side effects)
# - Stripped side effects: artifact uploads, PR comment posters, snapshot
# auto-commit (handle-snapshots), posthog-github-action telemetry,
-# --store-durations write, test-selection verdict
+# --store-durations write, test-selection verdict, Trunk flaky-test upload
+# (trunk-upload — the shadow strips the junit artifact uploads it would aggregate,
+# and must not post to the external Trunk service from a non-blocking timing trial)
# - 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
# - actions/cache reads/writes route to Depot Cache, not GitHub Actions Cache,
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index 4ccf2d42e5df..8d5edfc83252 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -3222,3 +3222,31 @@ jobs:
uv run --script .github/scripts/report_test_timings.py \
--min-duration-seconds=0.5 \
./junit-artifacts
+
+ trunk-upload:
+ name: Upload test results to Trunk
+ # Core/Temporal/async-migrations already emit and upload junit-results-* artifacts;
+ # this feeds them to Trunk (flaky-test detection) once. Trusted non-pull_request
+ # events only (master push + merge queue), so the secret token never runs in a
+ # PR-controlled context; the uploader is a pinned external action, not a local one.
+ needs: [django_tests]
+ runs-on: ubuntu-latest
+ continue-on-error: true
+ timeout-minutes: 10
+ if: always() && github.repository == 'PostHog/posthog' && github.event_name != 'pull_request'
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ fetch-depth: 1
+ - name: Download JUnit artifacts
+ uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v6.0.0
+ continue-on-error: true
+ with:
+ path: ./junit-artifacts
+ pattern: junit-results-*
+ - name: Upload to Trunk
+ uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
+ with:
+ junit-paths: junit-artifacts/**/*.xml
+ org-slug: posthog-inc
+ token: ${{ secrets.TRUNK_API_TOKEN }}
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.yml
index 6f2cc223fac9..29a4564f6034 100644
--- a/.github/workflows/ci-e2e-playwright.yml
+++ b/.github/workflows/ci-e2e-playwright.yml
@@ -680,6 +680,18 @@ jobs:
path: playwright/junit-results.xml
if-no-files-found: ignore
+ - name: Upload test results to Trunk
+ # Flaky-test detection. Trusted non-pull_request events only, so the secret token
+ # never runs in a PR-controlled context; continue-on-error so an upload hiccup
+ # never fails the job.
+ if: ${{ !cancelled() && github.event_name != 'pull_request' }}
+ continue-on-error: true
+ uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
+ with:
+ junit-paths: playwright/junit-results.xml
+ org-slug: posthog-inc
+ token: ${{ secrets.TRUNK_API_TOKEN }}
+
- name: Publish report to Cloudflare Pages
if: always() && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
id: cf-deploy