Skip to content

fix: switch CI to pnpm to resolve native binding failure on Linux runners#856

Merged
willtheorangeguy merged 2 commits intomainfrom
copilot/fix-github-actions-errors
Mar 2, 2026
Merged

fix: switch CI to pnpm to resolve native binding failure on Linux runners#856
willtheorangeguy merged 2 commits intomainfrom
copilot/fix-github-actions-errors

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

npm ci has a known bug (npm/cli#4828) where platform-specific optional dependencies aren't installed correctly — causing @tailwindcss/oxide to fail with "Cannot find native binding" on Linux CI runners when package-lock.json was generated on macOS.

The repo already ships a pnpm-lock.yaml, so switching to pnpm is the natural fix; pnpm resolves platform-specific optionals correctly.

Changes to .github/workflows/astro.yml

  • Package manager detectionpnpm-lock.yaml is now checked first; each branch emits a lockfile output so downstream steps stay generic
  • pnpm setup — adds pnpm/action-setup@v4 (pinned to v9, matching lockfileVersion: '9.0' in the lockfile) before setup-node so caching works
  • Dynamic cache-dependency-path — uses ${{ steps.detect-package-manager.outputs.lockfile }} instead of the hardcoded package-lock.json
  • Node.js 18 → 20 — 18 is EOL
- name: Install pnpm
  if: steps.detect-package-manager.outputs.manager == 'pnpm'
  uses: pnpm/action-setup@v4
  with:
    version: 9
- name: Setup Node
  uses: actions/setup-node@v6
  with:
    node-version: "20"
    cache: ${{ steps.detect-package-manager.outputs.manager }}
    cache-dependency-path: ${{ env.BUILD_PATH }}/${{ steps.detect-package-manager.outputs.lockfile }}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ing bug

Co-authored-by: willtheorangeguy <18339050+willtheorangeguy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix errors in deploy script for GitHub Actions fix: switch CI to pnpm to resolve native binding failure on Linux runners Mar 2, 2026
@willtheorangeguy willtheorangeguy marked this pull request as ready for review March 2, 2026 15:25
Copilot AI review requested due to automatic review settings March 2, 2026 15:25
@willtheorangeguy willtheorangeguy merged commit e8abd55 into main Mar 2, 2026
10 checks passed
@willtheorangeguy willtheorangeguy deleted the copilot/fix-github-actions-errors branch March 2, 2026 15:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GitHub Pages “Astro” workflow to prefer pnpm in CI (to avoid platform-specific optional dependency issues seen with npm ci), while also modernizing the Node runtime and making dependency caching lockfile-aware.

Changes:

  • Prefer pnpm-lock.yaml during package-manager detection and expose a lockfile output for downstream steps.
  • Add pnpm/action-setup@v4 (pnpm v9) and switch Node.js from 18 to 20.
  • Make actions/setup-node caching use a dynamic cache-dependency-path based on the detected lockfile.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +37 to 49
if [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
echo "manager=pnpm" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
echo "lockfile=pnpm-lock.yaml" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lockfile detection is hard-coded to ${{ github.workspace }} and ignores env.BUILD_PATH. If BUILD_PATH is set to a subfolder (as the workflow hints), this step will fail to detect the correct manager/lockfile even though later steps run from working-directory: ${{ env.BUILD_PATH }}. Consider checking for lockfiles under ${{ github.workspace }}/${{ env.BUILD_PATH }} (or cd into BUILD_PATH within this step) so detection stays consistent with the rest of the workflow.

Suggested change
if [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
echo "manager=pnpm" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
echo "lockfile=pnpm-lock.yaml" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
if [ -f "${{ github.workspace }}/${{ env.BUILD_PATH }}/pnpm-lock.yaml" ]; then
echo "manager=pnpm" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
echo "lockfile=pnpm-lock.yaml" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/${{ env.BUILD_PATH }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/${{ env.BUILD_PATH }}/package.json" ]; then

Copilot uses AI. Check for mistakes.
Comment on lines +39 to 45
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
echo "lockfile=pnpm-lock.yaml" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For CI determinism, pnpm install without a frozen/immutable flag can silently resolve and update the lockfile, which can make builds succeed despite lockfile drift. Consider setting the pnpm command output to use --frozen-lockfile (and similarly for yarn if you want parity with npm ci) so the workflow fails when the lockfile and manifest are out of sync.

Suggested change
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
echo "lockfile=pnpm-lock.yaml" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "command=install --frozen-lockfile" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
echo "lockfile=pnpm-lock.yaml" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install --frozen-lockfile" >> $GITHUB_OUTPUT

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants