From a3b3f4058e3d9ea56cc38f61f2d53b560cc55650 Mon Sep 17 00:00:00 2001 From: Youngduk Suh Date: Sun, 30 Oct 2022 08:12:34 +0900 Subject: [PATCH] Redirect output to variable --- action.yml | 7 ++++++- entrypoint.sh | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 2b30ae4..b88d37a 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,11 @@ inputs: args: description: 'Arguments for the CLI command' required: false + redirect-to: + description: 'Variable name to redirect CLI output' + required: false runs: using: 'docker' - image: 'Dockerfile' \ No newline at end of file + image: 'Dockerfile' + env: + dest: ${{ inputs.redirect-to }} diff --git a/entrypoint.sh b/entrypoint.sh index 77afe3d..6a0e6e5 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -37,4 +37,12 @@ if [ ! -f "$HOME/.kube/config" ]; then fi fi -kubectl $* \ No newline at end of file +if [ -z "$dest" ]; then + kubectl $* +else + output=$(kubectl $*) + echo "::set-output name=$dest::$output" + + # debug only + #echo $output +fi