Skip to content

Commit 55385f9

Browse files
authored
Merge pull request #187 from salesforcecli/sm/W-24093892
chore: 2.2 Add pnpmInstallWithRetries sibling action - W-24093892
2 parents 05c2fc3 + 635a988 commit 55385f9

4 files changed

Lines changed: 71 additions & 5 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: pnpm-install-with-retries
2+
description: 'wraps `pnpm install --frozen-lockfile` with retries/timeout to handle network failures'
3+
inputs:
4+
ignore-scripts:
5+
default: 'false'
6+
description: 'Skip pre/post install scripts'
7+
runs:
8+
using: composite
9+
steps:
10+
- name: pnpm install
11+
uses: salesforcecli/github-workflows/.github/actions/retry@main
12+
with:
13+
command: pnpm install --frozen-lockfile ${{ inputs.ignore-scripts == 'true' && '--ignore-scripts' || '' }}

‎.github/actions/setupNodeAndInstall/action.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ runs:
6969
if: inputs.package-manager == 'yarn' && steps.install-command.outputs.value == 'yarn install --network-timeout 600000'
7070
uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main
7171

72-
- name: Install custom or pnpm dependencies
73-
if: (inputs.package-manager != 'npm' || steps.install-command.outputs.value != 'npm ci') && (inputs.package-manager != 'yarn' || steps.install-command.outputs.value != 'yarn install --network-timeout 600000')
72+
- name: Install pnpm dependencies
73+
if: inputs.package-manager == 'pnpm' && steps.install-command.outputs.value == 'pnpm install --frozen-lockfile'
74+
uses: salesforcecli/github-workflows/.github/actions/pnpmInstallWithRetries@main
75+
76+
- name: Install custom dependencies
77+
if: (inputs.package-manager != 'npm' || steps.install-command.outputs.value != 'npm ci') && (inputs.package-manager != 'yarn' || steps.install-command.outputs.value != 'yarn install --network-timeout 600000') && (inputs.package-manager != 'pnpm' || steps.install-command.outputs.value != 'pnpm install --frozen-lockfile')
7478
uses: salesforcecli/github-workflows/.github/actions/retry@main
7579
with:
7680
command: ${{ steps.install-command.outputs.value }}

‎.github/workflows/npmPublish.yml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ jobs:
180180
uses: salesforcecli/github-workflows/.github/actions/npmInstallWithRetries@main
181181
- name: Install dependencies with pnpm
182182
if: inputs.packageManager == 'pnpm'
183-
uses: salesforcecli/github-workflows/.github/actions/retry@main
184-
with:
185-
command: pnpm install --frozen-lockfile
183+
uses: salesforcecli/github-workflows/.github/actions/pnpmInstallWithRetries@main
186184
- name: Vulnerability check
187185
if: inputs.vulnerabilityCheck
188186
# Check for known vulnerable packages from the following supply chain attacks:

‎plans/W-24093892.md‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# W-24093892 — 2.2 Add pnpmInstallWithRetries sibling action
2+
3+
## Context
4+
5+
`setupNodeAndInstall` already installs npm and Yarn through sibling composite actions, and resolves the default pnpm install to `pnpm install --frozen-lockfile`. That pnpm command still runs through the generic `retry` step (`.github/actions/setupNodeAndInstall/action.yml`).
6+
7+
Add `.github/actions/pnpmInstallWithRetries/action.yml` next to:
8+
9+
- `.github/actions/npmInstallWithRetries/action.yml` — `npm ci` via `retry`, `ignore-scripts` input
10+
- `.github/actions/yarnInstallWithRetries/action.yml` — `yarn install --network-timeout 600000` via `retry`, `ignore-scripts` input
11+
12+
Route the default pnpm command in `setupNodeAndInstall` through the new action. Custom `install-command` values stay on the generic `retry` step.
13+
14+
## Phases
15+
16+
### 1. Add the pnpm sibling and call it from setupNodeAndInstall
17+
18+
Commit: `Add pnpmInstallWithRetries for the default frozen-lockfile install`
19+
20+
Files:
21+
22+
- `.github/actions/pnpmInstallWithRetries/action.yml` (new)
23+
- `.github/actions/setupNodeAndInstall/action.yml`
24+
25+
`pnpmInstallWithRetries` is a composite action:
26+
27+
- `name`: `pnpm-install-with-retries`
28+
- `description`: wraps `pnpm install --frozen-lockfile` with retries/timeout to handle network failures
29+
- input `ignore-scripts`, default `'false'`, same description as the npm and yarn actions
30+
- one step, `pnpm install`, `uses: salesforcecli/github-workflows/.github/actions/retry@main`
31+
- `command`: `pnpm install --frozen-lockfile ${{ inputs.ignore-scripts == 'true' && '--ignore-scripts' || '' }}`
32+
33+
In `setupNodeAndInstall`, after the Yarn install step, add:
34+
35+
- name `Install pnpm dependencies`
36+
- `if: inputs.package-manager == 'pnpm' && steps.install-command.outputs.value == 'pnpm install --frozen-lockfile'`
37+
- `uses: salesforcecli/github-workflows/.github/actions/pnpmInstallWithRetries@main`
38+
39+
Extend the existing custom-install `if` with `(inputs.package-manager != 'pnpm' || steps.install-command.outputs.value != 'pnpm install --frozen-lockfile')` so the default pnpm command is only installed by the sibling. Rename that step from `Install custom or pnpm dependencies` to `Install custom dependencies`.
40+
41+
`setupNodeAndInstall` does not pass `ignore-scripts` into the npm or yarn actions; the pnpm call matches that.
42+
43+
## Skills to apply
44+
45+
Follow the composite-action shape already in `npmInstallWithRetries` and `yarnInstallWithRetries`: shared `retry` action, `ignore-scripts` input, install command equal to the string `setupNodeAndInstall` already resolves for that package manager (`pnpm install --frozen-lockfile` at the `Resolve install command` step).
46+
47+
## Verification
48+
49+
- New action inputs and `retry` usage match the npm and yarn siblings, with the install command `pnpm install --frozen-lockfile`.
50+
- `setupNodeAndInstall` default paths are exclusive: `npm` + `npm ci` → `npmInstallWithRetries`; `yarn` + `yarn install --network-timeout 600000` → `yarnInstallWithRetries`; `pnpm` + `pnpm install --frozen-lockfile` → `pnpmInstallWithRetries`; every other resolved command → `retry`.
51+
- Direct `npmInstallWithRetries` and `yarnInstallWithRetries` workflow uses stay unchanged.

0 commit comments

Comments
 (0)