From 11fa60953deea0e5c7e3e351c6a122723c90e81a Mon Sep 17 00:00:00 2001 From: GrantBirki Date: Thu, 7 Dec 2023 22:30:51 -0700 Subject: [PATCH] set another output for stderr as it will almost always contain 'some' data --- README.md | 2 ++ action.yml | 4 +++- src/index.ts | 11 +++-------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ab5d8bc..c303bd1 100644 --- a/README.md +++ b/README.md @@ -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!" diff --git a/action.yml b/action.yml index 6028b7d..88d0dd4 100644 --- a/action.yml +++ b/action.yml @@ -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)" diff --git a/src/index.ts b/src/index.ts index d40dfcb..318d8ec 100755 --- a/src/index.ts +++ b/src/index.ts @@ -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') - setOutput("command-output", stdOut); - } else if (stdErr) { - info('saving stderr to "command-output" output') - setOutput("command-output", stdErr); - } + // Set the outputs for the command + setOutput("command-output", stdOut); + setOutput("command-stderr", stdErr); } } finally { endGroup();