Skip to content

Commit

Permalink
gh-actions/github/run: Improve args (take 2) (#934)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <ryan@synca.io>
  • Loading branch information
phlax authored Nov 4, 2023
1 parent 9e8cdcd commit bddd762
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions gh-actions/github/run/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ inputs:
required: true
args:
type: string
command-prefix:
type: string
default:
container-command:
type: string
default:
Expand Down Expand Up @@ -47,16 +44,15 @@ runs:
rm -rf "$SOURCETMP"
fi
COMMAND=()
if [[ -n "${{ inputs.container-command }}" ]]; then
read -ra ARGS <<< "${{ inputs.args }}"
ACTUAL_COMMAND=(
${{ inputs.command }}
${ARGS[@]})
CONTAINER_COMMAND="${{ inputs.container-command }}"
if [[ "${#CONTAINER_COMMAND}" -ne 0 ]]; then
COMMAND+=(${{ inputs.container-command }})
fi
if [[ -n "${{ inputs.container-command }}" && -n "${{ inputs.command-prefix }}" ]]; then
COMMAND+=('${{ inputs.command-prefix }} ${{ inputs.command }}')
else
COMMAND+=(
${{ inputs.command-prefix }}
${{ inputs.command }})
fi
COMMAND+=("${ACTUAL_COMMAND[@]}")
TMP_OUTPUT=$(mktemp)
if [[ -n "$RUNNER_DEBUG" || -n "$CI_DEBUG" ]]; then
echo "DEBUG: RUN ${COMMAND[*]}" >&2
Expand Down

0 comments on commit bddd762

Please sign in to comment.