From a3ffebdf0c76e9b19bab58b843227e9bf9946905 Mon Sep 17 00:00:00 2001 From: Damir Mukimov Date: Thu, 27 Nov 2025 06:33:19 +0100 Subject: [PATCH] Fix Corepack/Yarn caching issue in CI workflows - Remove cache: yarn from setup-node action to prevent yarn usage before corepack enable - Enable corepack immediately after Node.js setup - Add manual yarn caching using actions/cache@v4 with proper cache directory path - This resolves the packageManager field conflict in CI --- .github/workflows/build.yml | 13 ++++++++++++- .github/workflows/lint.yml | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 185ed9a..bd3e36b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,11 +18,22 @@ jobs: uses: actions/setup-node@v6 with: node-version: "22" - cache: "yarn" - name: Enable Corepack run: corepack enable + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Cache yarn dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Install dependencies run: yarn install --frozen-lockfile diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d8ad201..a3c6afb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,11 +18,22 @@ jobs: uses: actions/setup-node@v6 with: node-version: "22" - cache: "yarn" - name: Enable Corepack run: corepack enable + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Cache yarn dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Install dependencies run: yarn install --frozen-lockfile