Skip to content

CI scaffold: pin pnpm version when packageManager field is absent #3172

@justin808

Description

@justin808

Context

Follow-up from PR #3097 review (comment).

The generated CI workflow at .github/workflows/ci.yml uses pnpm/action-setup@v4 without specifying a version:

- name: Set up pnpm
  uses: pnpm/action-setup@v4

Per the action's README, version is only optional when package.json contains a packageManager field. Otherwise it is required, and the step fails immediately.

Failure path

GeneratorMessages.detect_package_manager can select pnpm from pnpm-lock.yaml alone (priority 3 in the detection pipeline), without a packageManager field being present. This happens in existing apps where Shakapacker is already configured and the seeding path is skipped.

In that scenario, the scaffolded CI run fails in the pnpm setup step before dependency install or tests run.

Possible fixes

  • Emit with: version: <N> in the template when the generator can't confirm packageManager is set in package.json
  • Make the generator add a packageManager field to package.json whenever pnpm is detected via lockfile only
  • Add a comment in the generated workflow warning users that the pnpm step may need a version: key

Any of these would close the gap. Needs a design call on the right trade-off between "scaffold Just Works" and minimising template noise.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions