From 111f838a094bfdbd45c0877545f0428f7bba4cde Mon Sep 17 00:00:00 2001 From: Hugh Hackman Date: Sun, 22 Mar 2026 06:25:48 +0000 Subject: [PATCH] fix(ci): move corepack setup after setup-node to fix command-not-found corepack is bundled with Node.js and only available on PATH after actions/setup-node runs. The previous workflow ordered the corepack enable/install step before setup-node, causing: corepack: command not found Fix: move setup-node to run first. Because pnpm is not installed when setup-node runs, the built-in `cache: pnpm` cannot call `pnpm store path`. Split pnpm caching into explicit Get/Cache steps using actions/cache@v4 after pnpm is installed via either corepack or pnpm/action-setup. npm caching continues to use setup-node's built-in cache: npm. Fixes polaris PR #103 CI (headlamp-polaris-plugin v1.0.0 release). Co-Authored-By: Paperclip --- .github/workflows/plugin-ci.yaml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/plugin-ci.yaml b/.github/workflows/plugin-ci.yaml index eceeb44..59d7a58 100644 --- a/.github/workflows/plugin-ci.yaml +++ b/.github/workflows/plugin-ci.yaml @@ -35,6 +35,14 @@ jobs: echo "has_package_manager=false" >> $GITHUB_OUTPUT fi + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + # Only enable built-in npm caching here; pnpm caching is handled below + # after pnpm is installed (corepack is not available before setup-node). + cache: ${{ steps.pkg-manager.outputs.manager == 'npm' && 'npm' || '' }} + - name: Setup pnpm (via Corepack, reads version from packageManager field) if: steps.pkg-manager.outputs.manager == 'pnpm' && steps.pkg-manager.outputs.has_package_manager == 'true' run: | @@ -48,11 +56,19 @@ jobs: run_install: false version: latest - - name: Setup Node - uses: actions/setup-node@v4 + - name: Get pnpm store directory + id: pnpm-store + if: steps.pkg-manager.outputs.manager == 'pnpm' + run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT + + - name: Cache pnpm store + if: steps.pkg-manager.outputs.manager == 'pnpm' + uses: actions/cache@v4 with: - node-version: ${{ inputs.node-version }} - cache: ${{ steps.pkg-manager.outputs.manager }} + path: ${{ steps.pnpm-store.outputs.dir }} + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- - name: Install dependencies run: |