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. 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 ## Troubleshooting
### "I just started using Workers/Wrangler and I don't know what this is!" ### "I just started using Workers/Wrangler and I don't know what this is!"

View file

@ -46,4 +46,6 @@ inputs:
required: false required: false
outputs: outputs:
command-output: 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 // Execute the wrangler command
await exec(`${packageManager.exec} wrangler ${command}`, args, options); await exec(`${packageManager.exec} wrangler ${command}`, args, options);
// If stdOut contains data but stdErr does not, then save the stdOut value // Set the outputs for the command
if (stdOut && (!stdErr || stdErr === "" || stdErr === undefined)) { setOutput("command-output", stdOut);
info('saving stdout to "command-output" output') setOutput("command-stderr", stdErr);
setOutput("command-output", stdOut);
} else if (stdErr) {
info('saving stderr to "command-output" output')
setOutput("command-output", stdErr);
}
} }
} finally { } finally {
endGroup(); endGroup();