Skip to content

Commit

Permalink
Merge pull request #4 from wistia/mew/add_prefix_input
Browse files Browse the repository at this point in the history
feat!: add prefix input option to action
  • Loading branch information
okize authored Oct 13, 2023
2 parents fecb17a + f25976a commit ace06da
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ inputs:
description: "should the variables be uppercase?"
required: false
default: "true"
prefix:
description: "prefix applied before the tool version name (eg. tool_version_)"
required: false
postfix:
description: "postfix applied to the tool version name. default is _tool_version"
description: "postfix applied after the tool version name (eg. _tool_version)"
required: false
default: "_tool_version"
filename:
description: ".tool-versions filename. default .tool-versions"
required: false
Expand All @@ -27,7 +29,12 @@ runs:
run: |
while IFS= read -r line; do
if [[ $line != \#* ]]; then
NAME="$(echo $line | cut -d' ' -f1)${{inputs.postfix}}"
NAME="$(echo $line | cut -d' ' -f1)"
if [ "${{inputs.name_position}}" == "prefix" ]; then
NAME="${{inputs.prefix}}$NAME"
elif [ "${{inputs.name_position}}" == "postfix" ]; then
NAME="$NAME${{inputs.postfix}}"
fi
if [ "${{inputs.uppercase}}" == "true" ]; then NAME="$(echo $NAME | tr [:lower:] [:upper:])"; fi
VALUE=$(echo $line | cut -d' ' -f2-)
Expand Down

0 comments on commit ace06da

Please sign in to comment.