I faced a very similar issue while setting up GitHub Actions. You can consider using pnpm i --frozen-lockfile instead of yarn install --immutableif you are migrating from yarn to pnpm in GitHub actions.
pnpm i --frozen-lockfile
yarn install --immutable
yarn
pnpm