Skip to content

Resolve GitHub Actions pnpm conflict and enable PR workflow validation#136

Closed
SanderElias with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-pnpm-issues-in-actions
Closed

Resolve GitHub Actions pnpm conflict and enable PR workflow validation#136
SanderElias with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-pnpm-issues-in-actions

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown

GitHub Actions was failing in pnpm/action-setup because pnpm was declared twice with different specificity (version: 11 in workflow vs packageManager: pnpm@11.5.2 in package.json). This change removes the conflicting declarations so CI uses a single pnpm source of truth, and updates workflow triggering so the fix can be validated on pull requests without changing GitHub Pages deploy behavior.

  • Root cause addressed

    • Eliminated top-level pnpm/action-setup usage in .github/workflows/action.yml (build and deploy jobs), where version: 11 caused mismatch checks to fail.
  • Workflow simplification

    • Kept pnpm installation/version resolution in the existing composite action path (.github/build-artifacts.github/module-cache), which already derives pnpm from package.json#packageManager.
  • PR validation + deploy safety

    • Added pull_request trigger for main so Actions run on PRs.
    • Gated the deploy job with if: github.event_name == 'push' so GitHub Pages deployment still only happens on push to main.
  • Resulting behavior

    • CI no longer defines competing pnpm versions across workflow layers, preventing ERR_PNPM_BAD_PM_VERSION-style setup failures.
    • The workflow now validates PR changes while preserving main-branch-only deployment behavior.
# .github/workflows/action.yml (after)
on:
  pull_request:
    branches: [main]
  push:
    branches: [main]

jobs:
  build:
    steps:
      - uses: actions/checkout@v6
      - uses: ./.github/build-artifacts

  deploy:
    if: github.event_name == 'push'
    steps:
      - uses: actions/checkout@v6
      - uses: ./.github/build-artifacts
      - uses: JamesIves/github-pages-deploy-action@v4

Copilot AI changed the title Fix pnpm version conflict in GitHub Actions workflow Resolve GitHub Actions pnpm version conflict by removing duplicate setup Jun 8, 2026
Copilot AI requested a review from SanderElias June 8, 2026 15:09
@SanderElias

Copy link
Copy Markdown
Owner

@copilot can you run the actions to check if those now work without errors, while still deploying to github pages?

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 8, 2026

Copy link
Copy Markdown

Deploying samples with  Cloudflare Pages  Cloudflare Pages

Latest commit: 06c69ab
Status:🚫  Build failed.

View logs

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Author

@copilot can you run the actions to check if those now work without errors, while still deploying to github pages?

Done in commit 45661f3.

I updated the workflow to run on pull_request and kept deploy gated to pushes (if: github.event_name == 'push'), so GitHub Pages deploy behavior on main is preserved.

The workflow run was triggered for this PR: https://github.com/SanderElias/Samples/actions/runs/27147608496
It is currently action_required with 0 jobs started, so it needs manual approval in Actions before the build can execute.

Copilot AI changed the title Resolve GitHub Actions pnpm version conflict by removing duplicate setup Resolve GitHub Actions pnpm conflict and enable PR workflow validation Jun 8, 2026
Copilot AI requested a review from SanderElias June 8, 2026 15:18
@SanderElias

Copy link
Copy Markdown
Owner

@copilot it was approved, and failed

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Author

@copilot it was approved, and failed

Fixed in commit ec5159e.

The failure was because pnpm/action-setup was running on runner Node 20 before actions/setup-node, which is incompatible with pnpm 11.5.2. I reordered .github/module-cache/action.yaml to set up Node first, then install pnpm.

A new run was triggered: https://github.com/SanderElias/Samples/actions/runs/27148168908
It is currently action_required again (0 jobs), so once approved it should execute the build; deploy remains push-only.

@SanderElias

Copy link
Copy Markdown
Owner

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Author

@copilot https://github.com/SanderElias/Samples/actions/runs/27148168908/job/80269178595?pr=136

Fixed in commit 1ad8824.

That job failed at actions/setup-node with Unable to locate executable file: pnpm because cache: 'pnpm' was configured before pnpm was installed. I removed the cache: 'pnpm' option from .github/module-cache/action.yaml so setup-node no longer requires pnpm to exist at that point. pnpm is still installed from package.json#packageManager in the same action.

Copilot stopped work on behalf of SanderElias due to an error June 9, 2026 08:00
Copilot stopped work on behalf of SanderElias due to an error June 9, 2026 08:00
@SanderElias SanderElias closed this Jun 9, 2026
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.

2 participants