I’ve created a CLI tool using oclif and I have a PR gate GitHub Actions workflow to validate the functionality of my CLI. FWIW this question is applicable to a non-CLI codebase that has a workflow that actions a CLI tool with prompts.
The CLI is called like this:
npx @my-company/my-cli-tool my-command. When this is run, I’ve programmed the CLI to elicit user input to make a selection from a list of checkboxes before proceeding. When executing “manually” in a terminal, clicking the ENTER key when presented with the prompt will allow the rest of my command to execute (by submitting all the options that are selected by default). When I run this command in a workflow step, it of course, just dies because no user input is given (Error: Process completed with exit code 130.).
Is there a way to define a workflow step to effectively respond to CLI prompts? I was thinking something like this might work:
- run: | npx @my-company/my-cli-tool my-command sleep 10s echo '\n'
Worst case: I can update my CLI command to bypass the prompt if a certain flag is passed.