: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
perf(ci): restrict pnpm cache writes to master branch only (#59364)
mendral-app[bot]fcd5532383cf
diff --git a/.github/workflows/ci-docs-check.yml b/.github/workflows/ci-docs-check.ymlindex 933f1d8cbf1b..cc96691d4354 100644--- a/.github/workflows/ci-docs-check.yml+++ b/.github/workflows/ci-docs-check.yml@@ -57,10 +57,19 @@ jobs:uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:node-version-file: .nvmrc- cache: pnpm- cache-dependency-path: |- pnpm-lock.yaml- .github/workflows/ci-docs-check.yml++ - name: Get pnpm store path+ if: steps.source-check.outputs.changed == 'true'+ id: pnpm-store+ run: echo "path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT++ - name: Restore pnpm cache+ if: steps.source-check.outputs.changed == 'true'+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+ restore-keys: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-- name: Install dependenciesif: steps.source-check.outputs.changed == 'true'diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.ymlindex d0566024eece..fb3de63ae5aa 100644--- a/.github/workflows/ci-frontend.yml+++ b/.github/workflows/ci-frontend.yml@@ -119,16 +119,30 @@ jobs:uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:node-version-file: .nvmrc- cache: pnpm- cache-dependency-path: |- pnpm-lock.yaml- .github/workflows/ci-frontend.yml++ - name: Get pnpm store path+ id: pnpm-store+ run: echo "path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT++ - name: Restore pnpm cache+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+ restore-keys: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-- name: Install package.json dependencies with pnpmrun: |pnpm --filter=@posthog/playwright... install --frozen-lockfilebin/turbo --filter=@posthog/frontend prepare+ - name: Save pnpm cache+ if: github.ref == 'refs/heads/master'+ uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+- name: Check formatting with oxfmtrun: pnpm run format:frontend:check@@ -167,16 +181,30 @@ jobs:uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:node-version-file: .nvmrc- cache: pnpm- cache-dependency-path: |- pnpm-lock.yaml- .github/workflows/ci-frontend.yml++ - name: Get pnpm store path+ id: pnpm-store+ run: echo "path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT++ - name: Restore pnpm cache+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+ restore-keys: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-- name: Install package.json dependencies with pnpmrun: |pnpm --filter=@posthog/playwright... install --frozen-lockfilebin/turbo --filter=@posthog/frontend prepare+ - name: Save pnpm cache+ if: github.ref == 'refs/heads/master'+ uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+- name: Build productsrun: pnpm --filter=@posthog/frontend build:products@@ -258,16 +286,30 @@ jobs:uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:node-version-file: .nvmrc- cache: pnpm- cache-dependency-path: |- pnpm-lock.yaml- .github/workflows/ci-frontend.yml++ - name: Get pnpm store path+ id: pnpm-store+ run: echo "path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT++ - name: Restore pnpm cache+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+ restore-keys: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-- name: Install package.json dependencies with pnpmrun: |pnpm --filter=@posthog/playwright... install --no-frozen-lockfilebin/turbo --filter=@posthog/frontend prepare+ - name: Save pnpm cache+ if: github.ref == 'refs/heads/master'+ uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+- name: Restore .typegen cacheuses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3with:@@ -341,14 +383,28 @@ jobs:uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:node-version-file: .nvmrc- cache: pnpm- cache-dependency-path: |- pnpm-lock.yaml- .github/workflows/ci-frontend.yml++ - name: Get pnpm store path+ id: pnpm-store+ run: echo "path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT++ - name: Restore pnpm cache+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+ restore-keys: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-- name: Install package.json dependencies with pnpmrun: pnpm --filter=@posthog/frontend... install --frozen-lockfile+ - name: Save pnpm cache+ if: github.ref == 'refs/heads/master'+ uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+- name: Test with Jestrun: bin/turbo run test --filter=@posthog/frontend -- --maxWorkers=2env:diff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.ymlindex 9d494d0122ee..c00d5c5b55fb 100644--- a/.github/workflows/ci-storybook.yml+++ b/.github/workflows/ci-storybook.yml@@ -258,14 +258,28 @@ jobs:uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:node-version-file: .nvmrc- cache: pnpm- cache-dependency-path: |- pnpm-lock.yaml- .github/workflows/ci-storybook.yml++ - name: Get pnpm store path+ id: pnpm-store+ run: echo "path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT++ - name: Restore pnpm cache+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+ restore-keys: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-- name: Install package.json dependencies with pnpmrun: pnpm --filter=@posthog/storybook... install --frozen-lockfile+ - name: Save pnpm cache+ if: github.ref == 'refs/heads/master'+ uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+- name: Download Storybook build artifactuses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0with:@@ -386,10 +400,17 @@ jobs:uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0with:node-version-file: .nvmrc- cache: pnpm- cache-dependency-path: |- pnpm-lock.yaml- .github/workflows/ci-storybook.yml++ - name: Get pnpm store path+ id: pnpm-store+ run: echo "path=$(pnpm store path --silent)" >> $GITHUB_OUTPUT++ - name: Restore pnpm cache+ uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3+ with:+ path: ${{ steps.pnpm-store.outputs.path }}+ key: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}+ restore-keys: node-cache-${{ runner.os }}-${{ runner.arch }}-pnpm-- name: Install dependenciesrun: pnpm --filter=@posthog/storybook... install --frozen-lockfile