Enable package manager lifecycle mappings - W-23773464 - #169
Conversation
| - name: Validate package manager | ||
| shell: bash | ||
| run: | | ||
| if [ "${{ inputs.package-manager }}" != "npm" ] && [ "${{ inputs.package-manager }}" != "pnpm" ] && [ "${{ inputs.package-manager }}" != "yarn" ]; then |
There was a problem hiding this comment.
Avoid using inputs in a run:, it can be a RCE risk. Even if the risk is low (we control the inputs) it is still a good habit to use.
Instead set the input on the env: and then read from there. Here is an example
|
Overview Critical Issues
Fix: Add validation before executing:
🟡 .github/workflows/vscode-publish-extensions.yml:953 - Lockfile validation false positive if ! git diff --quiet -- "$lockfile"; then Fix: Capture lockfile state before version bump: Before version bumpfor lockfile in "${unexpected_lockfiles[@]}"; do ... version bump happens ...After version bumpfor lockfile in "${unexpected_lockfiles[@]}"; do if: needs.package.result == 'success' && inputs.publish-web-vsix Action Required: Add documentation for the new publish-web-vsix input quality: Fix: Add job-level conditional: quality: Problem: If a caller sets extensions-root: 'src' but forgets to override artifact-glob, the upload step finds 0 files, causing downstream failures. Fix: Either derive artifact-glob from extensions-root or add validation: artifact-glob: if: inputs.package-manager == 'npm' && inputs.install-command == 'npm ci' Recommendation: Use pattern matching or only check package-manager: if: inputs.package-manager == 'npm' && startsWith(inputs.install-command, 'npm ci') Problem: Workflows fail hard instead of skipping when the bundle script doesn't exist. Recommendation: Restore the existence check or document that callers must ensure scripts exist. Minor Issues Problem: Typos or empty values cause silent caching failures, slowing builds 2-3x. Recommendation: Add validation in setupNodeAndInstall action or document valid values clearly. Summary Critical: Fix silent build failure when BUILD_COMMAND is empty |
| - name: Setup Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v6 | ||
| - name: Setup Node.js and install dependencies | ||
| uses: salesforcecli/github-workflows/.github/actions/setupNodeAndInstall@ph/W-23773464-enable-pnpm-workflows |
There was a problem hiding this comment.
I'm sure you know this, but change all these back to main before merging. I have forgotten this before myself 😵💫
| uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main | ||
|
|
||
| - name: Install custom or pnpm dependencies | ||
| if: (inputs.package-manager != 'npm' || inputs.install-command != 'npm ci') && (inputs.package-manager != 'yarn' || inputs.install-command != 'yarn install --network-timeout 600000') |
There was a problem hiding this comment.
I think this if is not quite right.
If you pass package-manager = pnpm but forget to pass in the custom install-command input, the default npm ci will be used here with pnpm
if using pnpm:
!npm (true) && !yarn (true) -> true
-> Uses pnpm "installer" with install command npm ci
Summary
Validation
git diff --checknpm run ext-change-detector -- --help@W-23773464@