From f25976aec73bd40bac79e7104e90992746c0b025 Mon Sep 17 00:00:00 2001 From: Morgan Wigmanich Date: Fri, 13 Oct 2023 16:04:23 -0400 Subject: [PATCH] feat!: add prefix input option to action --- action.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index d9c27d8..df0ccba 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -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-)