feat: capture stdout and store as output (#287)
Some checks failed
testing main branch / default-user-name-password (push) Failing after 4s
testing main branch / check-ssh-key (push) Failing after 5s
testing main branch / support-key-passphrase (push) Failing after 4s
testing main branch / multiple-server (push) Failing after 4s
testing main branch / support-ed25519-key (push) Failing after 4s
testing main branch / testing-with-env (push) Failing after 4s
testing main branch / testing ipv6 (push) Failing after 23s
testing main branch / some special character (push) Failing after 4s
testing main branch / testing-capturing-output (push) Failing after 4s
testing stable version / default-user-name-password (push) Failing after 6s
testing stable version / check-ssh-key (push) Failing after 8s
testing stable version / support-key-passphrase (push) Failing after 7s
testing stable version / multiple-server (push) Failing after 5s
testing stable version / support-ed25519-key (push) Failing after 6s
testing stable version / testing-with-env (push) Failing after 10s

This commit is contained in:
Jesse
2024-12-03 18:49:35 -07:00
committed by GitHub
parent e13c387332
commit 102c0d2e5f
3 changed files with 64 additions and 2 deletions

View File

@@ -64,7 +64,14 @@ TARGET="${GITHUB_ACTION_PATH}/${CLIENT_BINARY}"
echo "Will download ${CLIENT_BINARY} from ${DOWNLOAD_URL_PREFIX}"
curl -fsSL --retry 5 --keepalive-time 2 "${DOWNLOAD_URL_PREFIX}/${CLIENT_BINARY}" -o ${TARGET}
chmod +x ${TARGET}
echo "======= CLI Version ======="
sh -c "${TARGET} --version" # print version
echo "==========================="
sh -c "${TARGET} $*" # run the command
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
echo 'stdout<<EOF' >> $GITHUB_OUTPUT # use heredoc for multiline output
sh -c "${TARGET} $*" | tee -a $GITHUB_OUTPUT # run the command
echo 'EOF' >> $GITHUB_OUTPUT
else
sh -c "${TARGET} $*" # run the command
fi