@actions/exec doesn't support multiple commands
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Hello! I ran this script through @actions/exec:
await exec.exec('npm ci && npm run build --if-present')
It was expanded and run:

So it looks like the first npm command was prefixed with /usr/local/bin, but the second wasn't. It also didn't throw an error, which made this difficult to debug. What's the right way to
cc https://github.com/JasonEtco/build-and-tag-action/issues/4
To Reproduce
Create an action:
package.json:
{
"scripts": {
"build": "echo \"Hello!\""
}
}
The action:
const exec = require('@actions/exec')
async function main () {
await exec.exec('npm ci && npm run build')
}
main()
Observe that the build command isn't properly run.
Expected behavior
I'd expect the above command to "just work" - but if not, it should throw an error instead of fail silently.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the @actions/exec package entry point and run the provided action using npm ci && npm run build, comparing the observed command expansion with the expected behavior. Trace how the command string is parsed and executed, then verify that multiple commands either run correctly or produce a clear error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- devops, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100