From f4a5d6c8bd6d9ce1159e64ce5c1c33a44f1058fa Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 20 Apr 2026 11:08:30 -0500 Subject: [PATCH] fix(ci): refresh lockfile for manifest-changing PRs --- .github/workflows/pr.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a45f392ebc2..dd93129bd5b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -19,6 +19,8 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + with: + fetch-depth: 0 - name: Block manual lockfile edits if: github.head_ref != 'chore/refresh-lockfile' @@ -108,6 +110,14 @@ jobs: node-version: 24 cache: pnpm + - name: Refresh lockfile when manifests change + run: | + changed="$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}")" + manifest_pattern='(^|/)package\.json$|^pnpm-workspace\.yaml$|^\.npmrc$|^pnpmfile\.(cjs|js|mjs)$' + if printf '%s\n' "$changed" | grep -Eq "$manifest_pattern"; then + pnpm install --lockfile-only --ignore-scripts --no-frozen-lockfile + fi + - name: Install dependencies run: pnpm install --frozen-lockfile @@ -134,6 +144,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup pnpm uses: pnpm/action-setup@v4 @@ -146,6 +158,14 @@ jobs: node-version: 24 cache: pnpm + - name: Refresh lockfile when manifests change + run: | + changed="$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}")" + manifest_pattern='(^|/)package\.json$|^pnpm-workspace\.yaml$|^\.npmrc$|^pnpmfile\.(cjs|js|mjs)$' + if printf '%s\n' "$changed" | grep -Eq "$manifest_pattern"; then + pnpm install --lockfile-only --ignore-scripts --no-frozen-lockfile + fi + - name: Install dependencies run: pnpm install --frozen-lockfile