Switching default package manager to pnpm
Prerequisite
- A GitHub repository with the Speakeasy SDK Generation GitHub Action (opens in a new tab) integrated and enabled.
Adding pnpm
Support
- Open the GitHub Actions workflow file (e.g.,
.github/workflows/sdk-generation.yaml
). - Modify the
generate
job to include thepnpm_version
input. This ensures pnpm is installed during the action.
Example Workflow File
name: Generatepermissions:checks: writecontents: writepull-requests: writestatuses: write'on':workflow_dispatch:inputs:force:description: Force generation of SDKstype: booleandefault: falseset_version:description: Optionally set a specific SDK versiontype: stringjobs:generate:uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15with:force: ${{ github.event.inputs.force }}mode: prset_version: ${{ github.event.inputs.set_version }}speakeasy_version: latestworking_directory: packages/sdkpnpm_version: "9.19.4" # Specify the required pnpm versionsecrets:github_access_token: ${{ secrets.GITHUB_TOKEN }}npm_token: ${{ secrets.NPM_TOKEN_ELEVATED }}speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
(Optional) Verifying pnpm
Installation
Ensure pnpm is used in the workflow by adding a step to verify its presence:
steps:- name: Verify pnpm installationrun: pnpm --version
This outputs the installed pnpm
version for confirmation during workflow execution.
Additional Notes
- Use the same
pnpm_version
as used in local development for consistency. - Ensure any
package.json
files are compatible with pnpm. Runpnpm install
locally to verify.