Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

ci: tighten GitHub Actions cache policy (#13613)

Tobias Wochingera7704185bd93
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index 0f37bd53a8..a755114d76 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -19,6 +19,21 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+env:
+ # Keep the test job node-version matrices in sync. GitHub does not allow the
+ # env context in jobs.<job_id>.name, so matrix jobs use matrix.node-version
+ # for their display names.
+ NODE_VERSION: 24
+
+ # Disable CI cache restores for fork PRs.
+ #
+ # Fork PRs can only read base-branch caches, and CI cache paths must not
+ # contain secrets. This is conservative defense-in-depth, not required for
+ # release cache integrity: PR-created caches are scoped to the PR merge ref,
+ # main does not restore them, and release image builds intentionally do not
+ # restore CI caches.
+ CI_CACHE_ALLOWED: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
+
jobs:
pre-job:
runs-on: blacksmith-4vcpu-ubuntu-2404
@@ -84,12 +99,21 @@ jobs:
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] lint job dependency cache only; no released artifacts are built or published from this cached state
+ - name: Use Node.js ${{ env.NODE_VERSION }} without cache
+ if: env.CI_CACHE_ALLOWED != 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
- node-version: 24
+ node-version: ${{ env.NODE_VERSION }}
+ package-manager-cache: false
+ - name: Use Node.js ${{ env.NODE_VERSION }} with pnpm cache
+ if: env.CI_CACHE_ALLOWED == 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] lint job dependency cache only; no released artifacts are built or published from this cached state
+ with:
+ node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: Setup Turbo cache
+ if: env.CI_CACHE_ALLOWED == 'true'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 # zizmor: ignore[cache-poisoning] lint cache only; publish jobs rebuild artifacts and do not restore this cache
with:
path: .turbo
@@ -121,9 +145,17 @@ jobs:
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] prettier check dependency cache only; no released artifacts are built or published from this cached state
+ - name: Use Node.js ${{ env.NODE_VERSION }} without cache
+ if: env.CI_CACHE_ALLOWED != 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ package-manager-cache: false
+ - name: Use Node.js ${{ env.NODE_VERSION }} with pnpm cache
+ if: env.CI_CACHE_ALLOWED == 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] prettier check dependency cache only; no released artifacts are built or published from this cached state
with:
- node-version: 24
+ node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: install dependencies
@@ -164,9 +196,17 @@ jobs:
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] eslint-plugin test dependency cache only; no published artifacts are built from this cached state
+ - name: Use Node.js ${{ env.NODE_VERSION }} without cache
+ if: env.CI_CACHE_ALLOWED != 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
- node-version: 24
+ node-version: ${{ env.NODE_VERSION }}
+ package-manager-cache: false
+ - name: Use Node.js ${{ env.NODE_VERSION }} with pnpm cache
+ if: env.CI_CACHE_ALLOWED == 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] eslint-plugin test dependency cache only; no published artifacts are built from this cached state
+ with:
+ node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: install dependencies
@@ -274,7 +314,14 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME_READ }}
password: ${{ secrets.DOCKERHUB_TOKEN_READ }}
- - name: Use Node.js ${{ matrix.node-version }}
+ - name: Use Node.js ${{ matrix.node-version }} without cache
+ if: env.CI_CACHE_ALLOWED != 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
+ with:
+ node-version: ${{ matrix.node-version }}
+ package-manager-cache: false
+ - name: Use Node.js ${{ matrix.node-version }} with pnpm cache
+ if: env.CI_CACHE_ALLOWED == 'true'
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] test job dependency cache only; no released artifacts are built or published from this cached state
with:
node-version: ${{ matrix.node-version }}
@@ -296,6 +343,7 @@ jobs:
echo "LANGFUSE_EE_LICENSE_KEY=langfuse_ee_test" >> .env
echo "LANGFUSE_SKIP_EVALUATOR_MODEL_CALL_VALIDATION=true" >> .env
- name: Setup Turbo cache
+ if: env.CI_CACHE_ALLOWED == 'true'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 # zizmor: ignore[cache-poisoning] test job cache only; publish jobs rebuild artifacts and do not restore this cache
with:
path: .turbo
@@ -303,6 +351,7 @@ jobs:
restore-keys: |
${{ runner.os }}-turbo-
- name: Cache Next.js builds
+ if: env.CI_CACHE_ALLOWED == 'true'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 # zizmor: ignore[cache-poisoning] test-only Next.js cache; not consumed by artifact publishing or release jobs
with:
path: |
@@ -389,7 +438,14 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME_READ }}
password: ${{ secrets.DOCKERHUB_TOKEN_READ }}
- - name: Use Node.js ${{ matrix.node-version }}
+ - name: Use Node.js ${{ matrix.node-version }} without cache
+ if: env.CI_CACHE_ALLOWED != 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
+ with:
+ node-version: ${{ matrix.node-version }}
+ package-manager-cache: false
+ - name: Use Node.js ${{ matrix.node-version }} with pnpm cache
+ if: env.CI_CACHE_ALLOWED == 'true'
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] worker test dependency cache only; no release artifacts are produced from this cache
with:
node-version: ${{ matrix.node-version }}
@@ -465,12 +521,13 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME_READ }}
password: ${{ secrets.DOCKERHUB_TOKEN_READ }}
- - name: Use Node.js 24
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] llm-connection test dependency cache only; privileged secrets are used here, but this cache is not consumed by artifact publishing
+ # Keep this secret-bearing job cache-cold to avoid exposing real provider
+ # credentials to potentially poisoned shared package-manager state.
+ - name: Use Node.js ${{ env.NODE_VERSION }}
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
- node-version: 24
- cache: "pnpm"
- cache-dependency-path: "pnpm-lock.yaml"
+ node-version: ${{ env.NODE_VERSION }}
+ package-manager-cache: false
- name: install dependencies
run: |
pnpm install
@@ -535,9 +592,17 @@ jobs:
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] e2e dependency cache only; release images are rebuilt later without restoring this cache
+ - name: Use Node.js ${{ env.NODE_VERSION }} without cache
+ if: env.CI_CACHE_ALLOWED != 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ package-manager-cache: false
+ - name: Use Node.js ${{ env.NODE_VERSION }} with pnpm cache
+ if: env.CI_CACHE_ALLOWED == 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] e2e dependency cache only; release images are rebuilt later without restoring this cache
with:
- node-version: 24
+ node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: Login to Docker Hub
@@ -547,6 +612,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME_READ }}
password: ${{ secrets.DOCKERHUB_TOKEN_READ }}
- name: Setup Turbo cache
+ if: env.CI_CACHE_ALLOWED == 'true'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 # zizmor: ignore[cache-poisoning] e2e cache only; no published artifact path restores this cache
with:
path: .turbo
@@ -555,6 +621,7 @@ jobs:
${{ runner.os }}-turbo-e2e-
${{ runner.os }}-turbo-
- name: Cache Next.js builds
+ if: env.CI_CACHE_ALLOWED == 'true'
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 # zizmor: ignore[cache-poisoning] e2e-only Next.js cache; not part of any artifact build or publishing flow
with:
path: |
@@ -626,9 +693,17 @@ jobs:
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] server e2e dependency cache only; release/publish steps rebuild separately
+ - name: Use Node.js ${{ env.NODE_VERSION }} without cache
+ if: env.CI_CACHE_ALLOWED != 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ package-manager-cache: false
+ - name: Use Node.js ${{ env.NODE_VERSION }} with pnpm cache
+ if: env.CI_CACHE_ALLOWED == 'true'
+ uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 # zizmor: ignore[cache-poisoning] server e2e dependency cache only; release/publish steps rebuild separately
with:
- node-version: 24
+ node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: install dependencies
diff --git a/.github/workflows/sdk-api-spec.yml b/.github/workflows/sdk-api-spec.yml
index f8e7c86b6e..ef5ae9247e 100644
--- a/.github/workflows/sdk-api-spec.yml
+++ b/.github/workflows/sdk-api-spec.yml
@@ -30,11 +30,13 @@ jobs:
with:
version: 10.33.0
+ # Keep this secret-bearing job cache-cold to avoid exposing Fern and
+ # GitHub write credentials to potentially poisoned shared package-manager state.
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "24"
- cache: "pnpm"
+ package-manager-cache: false
- name: Install dependencies
run: pnpm install