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.

perf(ci): install only turbo for the affected dry run (#95082)

posthog[bot]063aed37bff4
diff --git a/.github/workflows/ci-turbo.yml b/.github/workflows/ci-turbo.yml
index d268526372b1..c03ad8a36d65 100644
--- a/.github/workflows/ci-turbo.yml
+++ b/.github/workflows/ci-turbo.yml
@@ -5,9 +5,6 @@ name: Turbo CI
on:
workflow_call:
- secrets:
- GH_APP_POSTHOG_SETUP_ACTIONS_PRIVATE_KEY:
- required: false
jobs:
turbo-affected-4:
@@ -28,12 +25,6 @@ jobs:
# Just fetch the current commit/PR head
fetch-depth: 1
- - name: Detect architecture
- if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
- run: |
- ARCH=$(uname -m)
- echo "ARCH=$ARCH" >> $GITHUB_ENV
-
# Conditionally fetch the base branch so Turborepo can compare against it
- name: Fetch base branch
run: |
@@ -52,25 +43,32 @@ jobs:
echo "TURBO_SCM_BASE=master" >> $GITHUB_ENV
fi
- - name: Mint setup-action GitHub token
- id: setup-gh-token
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
- continue-on-error: true
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
- with:
- client-id: ${{ vars.GH_APP_POSTHOG_SETUP_ACTIONS_APP_ID }}
- private-key: ${{ secrets.GH_APP_POSTHOG_SETUP_ACTIONS_PRIVATE_KEY }}
- skip-token-revoke: true
-
- - name: Install pnpm dependencies
- uses: ./.github/actions/pnpm-install
- with:
- install-command: pnpm install --frozen-lockfile --filter=@posthog/root
- token: ${{ steps.setup-gh-token.outputs.token || github.token }}
+ # Turbo only, not the workspace. The dry run builds the task graph
+ # from the package manifests, turbo.json and the lockfile. It runs no
+ # task, so it never reads node_modules.
+ #
+ # The version comes from package.json, so a bump there cannot leave
+ # this job on an older Turbo than the workspace pins. Turbo warns
+ # that it found no local install. That warning is expected here.
+ #
+ # Turbo ships a prebuilt binary, and this job runs no package
+ # script, so the runner's own Node is enough to start it and the job
+ # needs no setup-node step.
+ - name: Install turbo
+ env:
+ # Keep a registry blip from failing the job.
+ npm_config_fetch_retries: 3
+ npm_config_fetch_retry_mintimeout: 10000
+ npm_config_fetch_retry_maxtimeout: 60000
+ # Installed under RUNNER_TEMP, which is always writable, rather
+ # than into the workspace, where a node_modules directory would
+ # change what Turbo hashes.
+ run: |
+ version="$(jq -re '.devDependencies.turbo | ltrimstr("^")' package.json)"
+ npm install --prefix "$RUNNER_TEMP/turbo" --no-audit --no-fund --no-save "turbo@$version"
+ echo "$RUNNER_TEMP/turbo/node_modules/.bin" >> "$GITHUB_PATH"
- name: Turbo Affected
- run: |
- bin/turbo build --affected --dry-run
+ run: turbo build --affected --dry-run
env:
- NODE_OPTIONS: --max-old-space-size=8192
TURBO_SCM_BASE: ${{ env.TURBO_SCM_BASE }}
diff --git a/.github/workflows/pr-housekeeping.yml b/.github/workflows/pr-housekeeping.yml
index 94757579dd68..ce7e6fe485b9 100644
--- a/.github/workflows/pr-housekeeping.yml
+++ b/.github/workflows/pr-housekeeping.yml
@@ -35,8 +35,6 @@ jobs:
turbo:
if: contains(fromJSON('["opened", "synchronize", "reopened"]'), github.event.action)
uses: ./.github/workflows/ci-turbo.yml
- secrets:
- GH_APP_POSTHOG_SETUP_ACTIONS_PRIVATE_KEY: ${{ secrets.GH_APP_POSTHOG_SETUP_ACTIONS_PRIVATE_KEY }}
trunk-impacted-targets:
# Also on ready_for_review: Trunk keys the upload to a head SHA, and a PR