Redirect output to variable

This commit is contained in:
Youngduk Suh 2022-10-30 08:12:34 +09:00
parent 84d2a4c8aa
commit a3b3f4058e
2 changed files with 15 additions and 2 deletions

View File

@ -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'
env:
dest: ${{ inputs.redirect-to }}

View File

@ -37,4 +37,12 @@ if [ ! -f "$HOME/.kube/config" ]; then
fi
fi
if [ -z "$dest" ]; then
kubectl $*
else
output=$(kubectl $*)
echo "::set-output name=$dest::$output"
# debug only
#echo $output
fi