From a3c6d747c4df986bdf3b2f47d77d60f9b0cf215c Mon Sep 17 00:00:00 2001 From: Jesse Date: Tue, 2 Jan 2024 21:00:45 +0000 Subject: [PATCH] Include stdout and stderr to file --- action.yml | 5 +++++ entrypoint.sh | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 405b14a..6b55ee0 100644 --- a/action.yml +++ b/action.yml @@ -67,6 +67,11 @@ inputs: description: 'Enable debug mode.' allenvs: description: 'pass all environment variable to shell script.' +outputs: + stdout: + description: 'Standard output of the executed commands.' + stderr: + description: 'Standard error of the executed commands.' runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index f880594..584336a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,4 +4,11 @@ set -eu export GITHUB="true" -sh -c "/bin/drone-ssh $*" +{ + sh -c "/bin/drone-ssh $*" +} 2> /tmp/errFile | tee /tmp/outFile + +stdout=$(cat /tmp/outFile) +stderr=$(cat /tmp/errFile) +echo "stdout=${stdout//$'\n'/\\n}" >> $GITHUB_OUTPUT +echo "stderr=${stderr//$'\n'/\\n}" >> $GITHUB_OUTPUT