set another output for stderr as it will almost always contain 'some' data

This commit is contained in:
GrantBirki 2023-12-07 22:30:51 -07:00
parent 5ee7b681bc
commit 11fa60953d
No known key found for this signature in database
GPG key ID: 96DF969ECBD266FE
3 changed files with 8 additions and 9 deletions

View file

@ -241,6 +241,8 @@ More advanced workflows may need to parse the resulting output of Wrangler comma
Now when you run your workflow, you will see the full output of the Wrangler command in your workflow logs. You can also use this output in subsequent workflow steps to parse the output for specific values.
> Note: the `command-stderr` output variable is also available if you need to parse the standard error output of the Wrangler command.
## Troubleshooting
### "I just started using Workers/Wrangler and I don't know what this is!"

View file

@ -46,4 +46,6 @@ inputs:
required: false
outputs:
command-output:
description: "The output of the Wrangler command"
description: "The output of the Wrangler command (comes from stdout)"
command-stderr:
description: "The error output of the Wrangler command (comes from stderr)"

View file

@ -264,14 +264,9 @@ async function wranglerCommands() {
// Execute the wrangler command
await exec(`${packageManager.exec} wrangler ${command}`, args, options);
// If stdOut contains data but stdErr does not, then save the stdOut value
if (stdOut && (!stdErr || stdErr === "" || stdErr === undefined)) {
info('saving stdout to "command-output" output')
// Set the outputs for the command
setOutput("command-output", stdOut);
} else if (stdErr) {
info('saving stderr to "command-output" output')
setOutput("command-output", stdErr);
}
setOutput("command-stderr", stdErr);
}
} finally {
endGroup();