Skip to content

Behavior when run in a GitHub Actions workflow via npx/npm exec prompts for confirmation and fails on Windows #35

@DavidAnson

Description

@DavidAnson

Given the GitHub Actions workflow step:

- run: npm exec --yes del-cli node_modules package.json npm-shrinkwrap.json

I observe the following behavior:

macOS:

Run npm exec --yes del-cli node_modules package.json npm-shrinkwrap.json
  npm exec --yes del-cli node_modules package.json npm-shrinkwrap.json
  shell: /bin/bash -e {0}

Ubuntu:

Run npm exec --yes del-cli node_modules package.json npm-shrinkwrap.json
  npm exec --yes del-cli node_modules package.json npm-shrinkwrap.json
  shell: /usr/bin/bash -e {0}

Windows:

Run npm exec --yes del-cli node_modules package.json npm-shrinkwrap.json
  npm exec --yes del-cli node_modules package.json npm-shrinkwrap.json
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
D:\a\markdownlint-cli2\markdownlint-cli2\node_modules\*, Are you sure (Y/N)? 
Error: Process completed with exit code 1.

Obviously, the failure on Windows is unexpected.

I am aware of the following recommendation, but do not see how to apply it in this scenario:

Windows users: Since $ del is already a builtin command on Windows, you need to use $ del-cli there.

My guess is that npx/npm exec runs the first command listed in package.json/bin - in which case putting del-cli before del would give the correct behavior on all platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions