Skip to content

Commit

Permalink
Redirect output to variable
Browse files Browse the repository at this point in the history
  • Loading branch information
skyducks committed Oct 29, 2022
1 parent 84d2a4c commit a3b3f40
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
image: 'Dockerfile'
env:
dest: ${{ inputs.redirect-to }}
10 changes: 9 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@ if [ ! -f "$HOME/.kube/config" ]; then
fi
fi

kubectl $*
if [ -z "$dest" ]; then
kubectl $*
else
output=$(kubectl $*)
echo "::set-output name=$dest::$output"

# debug only
#echo $output
fi

0 comments on commit a3b3f40

Please sign in to comment.