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.

fix(ci): mirror setup-turbo for the depot shadow (#96901)

Raúl Negrón-Otero784177fead5d
diff --git a/.depot/actions/setup-python-cached/action.yml b/.depot/actions/setup-python-cached/action.yml
index 84f16ad20861..68852daa27ba 100644
--- a/.depot/actions/setup-python-cached/action.yml
+++ b/.depot/actions/setup-python-cached/action.yml
@@ -1,6 +1,3 @@
-# Depot mirror of .github/actions/setup-python-cached (same pattern as .depot/actions/pnpm-install).
-# Kept byte-for-byte equivalent to canonical. actions/cache routes to Depot Cache, so the shared
-# keys do not collide.
name: Set up Python
description: |
Wraps actions/setup-python with a pre-seeded tool cache
diff --git a/.depot/actions/setup-turbo/action.yml b/.depot/actions/setup-turbo/action.yml
new file mode 100644
index 000000000000..f286357b4c93
--- /dev/null
+++ b/.depot/actions/setup-turbo/action.yml
@@ -0,0 +1,51 @@
+name: Install turbo
+description: |
+ Puts the lockfile-pinned `turbo` binary on PATH, for a job that runs turbo
+ tasks but does not need the workspace installed.
+
+ Requires pnpm and Node on PATH already: pnpm resolves and fetches the
+ package, and turbo shells out through pnpm to launch each task.
+
+inputs:
+ lockfile:
+ description: 'pnpm lockfile that pins the turbo version and integrity.'
+ required: false
+ default: pnpm-lock.yaml
+
+runs:
+ using: composite
+ steps:
+ - name: Install turbo
+ shell: bash
+ env:
+ LOCKFILE: ${{ inputs.lockfile }}
+ npm_config_fetch_retries: 3
+ npm_config_fetch_retry_mintimeout: 10000
+ npm_config_fetch_retry_maxtimeout: 60000
+ run: |
+ set -euo pipefail
+
+ # Every turbo entry, as "<name>@<version> <integrity>". Comparing the
+ # whole set catches a registry that serves different bytes than the
+ # ones committed here, which resolving by version alone would accept.
+ turbo_packages='.packages | to_entries
+ | map(select(.key | test("^(turbo|@turbo/)")))
+ | map(.key + " " + .value.resolution.integrity) | sort | .[]'
+
+ version=$(yq -e '.importers["."].devDependencies.turbo.version' "$LOCKFILE")
+
+ # Outside the workspace, so pnpm treats it as its own project and
+ # writes nothing into the checkout.
+ dir="$RUNNER_TEMP/turbo"
+ mkdir -p "$dir"
+ echo '{"name":"turbo-runner","private":true}' > "$dir/package.json"
+ pnpm --dir "$dir" add "turbo@$version"
+
+ if ! diff <(yq -r "$turbo_packages" "$LOCKFILE") \
+ <(yq -r "$turbo_packages" "$dir/pnpm-lock.yaml"); then
+ echo "::error::turbo resolved to different bytes than $LOCKFILE pins"
+ exit 1
+ fi
+
+ echo "$dir/node_modules/.bin" >> "$GITHUB_PATH"
+ "$dir/node_modules/.bin/turbo" --version
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index 56ec1526b05f..dd36ab9a4411 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -10,9 +10,11 @@
# Intentional deltas vs canonical (everything else is kept apples-to-apples):
# - runs-on: depot-* labels instead of ubuntu-latest
# - action paths: ./.depot/actions/... instead of ./.github/actions/... (pnpm-install,
-# setup-sqlx-cli, setup-python-cached, setup-uv, and paths-filter mirror the canonical
-# composites; any deltas are documented in each mirror's header). Keep the local
-# action mirrors available in .depot/actions so Depot can resolve their manifests.
+# setup-sqlx-cli, setup-python-cached, setup-uv, setup-turbo, and paths-filter mirror
+# the canonical composites; any deltas are documented in each mirror's header). Every
+# local action a depot workflow uses needs a mirror even when it is identical to
+# canonical: Depot resolves ./.github/actions/<x> from .depot/actions/<x>, so a missing
+# mirror fails the step at setup with "action manifest not found".
# - permissions: pull-requests:read (no comment/auto-commit side effects)
# - Stripped side effects: artifact uploads, CI report section posters (canonical
# additionally skips these on trunk-merge/** branches to save GITHUB_TOKEN budget;
@@ -1046,7 +1048,7 @@ jobs:
token: ${{ steps.setup-gh-token.outputs.token || github.token }}
# Needs pnpm from the step above.
- name: Install turbo
- uses: ./.github/actions/setup-turbo
+ uses: ./.depot/actions/setup-turbo
- name: Install uv
id: setup-uv
diff --git a/.github/workflows/ci-backend-shadow-drift.yml b/.github/workflows/ci-backend-shadow-drift.yml
index 76a4cd46326a..7ae0c1a65cbe 100644
--- a/.github/workflows/ci-backend-shadow-drift.yml
+++ b/.github/workflows/ci-backend-shadow-drift.yml
@@ -1,8 +1,8 @@
name: Backend CI shadow drift check
-# Fails when the canonical backend workflow or its paths-filter action changes
+# Fails when the canonical backend workflow or a mirrored local action changes
# without a matching update to the Depot shadow. The workflow is hand-maintained
-# (see its header comment for intentional deltas), while the action is vendored;
+# (see its header comment for intentional deltas), while the actions are vendored;
# without this check, canonical drifts silently and the Depot timing trial stops
# measuring the same work.
#
@@ -20,6 +20,18 @@ on:
- .depot/workflows/ci-backend.yml
- .github/actions/paths-filter/**
- .depot/actions/paths-filter/**
+ - .github/actions/pnpm-install/**
+ - .depot/actions/pnpm-install/**
+ - .github/actions/setup-pnpm/**
+ - .depot/actions/setup-pnpm/**
+ - .github/actions/setup-python-cached/**
+ - .depot/actions/setup-python-cached/**
+ - .github/actions/setup-sqlx-cli/**
+ - .depot/actions/setup-sqlx-cli/**
+ - .github/actions/setup-turbo/**
+ - .depot/actions/setup-turbo/**
+ - .github/actions/setup-uv/**
+ - .depot/actions/setup-uv/**
permissions:
contents: read
@@ -47,11 +59,15 @@ jobs:
# is the merge commit — diffing BASE_SHA..HEAD gives the PR's effective
# changes. We only need to fetch BASE_SHA (HEAD is already local).
git fetch --no-tags --depth=100 origin "$BASE_SHA"
+ # Every local action the depot workflow uses has a mirror under .depot/actions.
+ # The first group is kept byte-identical to canonical; the second carries
+ # intentional deltas documented in each mirror's header.
+ equal_mirrors="paths-filter setup-python-cached setup-sqlx-cli setup-turbo setup-uv"
+ delta_mirrors="pnpm-install setup-pnpm"
changed=$(git diff --name-only "$BASE_SHA" HEAD -- \
.github/workflows/ci-backend.yml \
.depot/workflows/ci-backend.yml \
- .github/actions/paths-filter \
- .depot/actions/paths-filter)
+ .github/actions .depot/actions)
if echo "$changed" | grep -Fxq '.github/workflows/ci-backend.yml' && \
! echo "$changed" | grep -Fxq '.depot/workflows/ci-backend.yml'; then
echo "::error::Canonical .github/workflows/ci-backend.yml changed without a matching update to .depot/workflows/ci-backend.yml."
@@ -63,14 +79,20 @@ jobs:
! echo "$changed" | grep -Fxq '.github/workflows/ci-backend.yml'; then
echo "::notice::Only the depot shadow changed. That is allowed (e.g. tuning a depot-only knob), but worth a glance from the reviewer."
fi
- if echo "$changed" | grep -q '^\.github/actions/paths-filter/' && \
- ! echo "$changed" | grep -q '^\.depot/actions/paths-filter/'; then
- echo "::error::Canonical .github/actions/paths-filter changed without a matching update to .depot/actions/paths-filter."
- echo "Mirror the action change so the Depot workflow evaluates the same path filters."
- exit 1
- fi
- if ! diff -qr .github/actions/paths-filter .depot/actions/paths-filter; then
- echo "::error::The Depot paths-filter action differs from its canonical copy."
- exit 1
- fi
+ for action in $equal_mirrors $delta_mirrors; do
+ for canonical_file in $(echo "$changed" | grep "^\.github/actions/$action/" || true); do
+ mirror_file=".depot/actions/$action/${canonical_file#".github/actions/$action/"}"
+ if ! echo "$changed" | grep -Fxq "$mirror_file"; then
+ echo "::error::Canonical $canonical_file changed without a matching update to $mirror_file."
+ echo "Mirror the action change so the Depot workflow runs the same steps."
+ exit 1
+ fi
+ done
+ done
+ for action in $equal_mirrors; do
+ if ! diff -qr ".github/actions/$action" ".depot/actions/$action"; then
+ echo "::error::The Depot $action action differs from its canonical copy."
+ exit 1
+ fi
+ done
echo "Shadow drift check passed."