feat: redirect output to the variable (#14)

Redirect output to the variable
This commit is contained in:
Serhiy Mytrovtsiy 2022-11-03 19:43:14 +01:00 committed by GitHub
commit 79f1b8008a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
kubectl $*
if [ -z "$dest" ]; then
kubectl $*
else
echo "$dest<<EOF" >> $GITHUB_ENV
kubectl $* >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "::add-mask::$dest"
fi