Skip to content

Commit

Permalink
add action
Browse files Browse the repository at this point in the history
  • Loading branch information
rsheldiii committed Sep 8, 2021
1 parent de46461 commit 9276588
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Parse .tool-versions'
description: 'Parse .tool-versions file, setting versions in env variables'
inputs:
uppercase:
description: "should the variables be uppercase?"
required: false
default: "true"
postfix:
description: "postfix applied to the tool version name. default is _tool_version"
required: false
default: "_tool_version"
filename:
description: ".tool-versions filename. default .tool-versions"
required: false
default: '.tool-versions'

runs:
using: "composite"
steps:
- name: Retrieve version
id: version
shell: bash
run: |
while IFS= read -r line; do
NAME="$(echo $line | cut -d' ' -f1)${{inputs.postfix}}"
if [ "${{inputs.uppercase}}" == "true" ]; then NAME="$(echo $NAME | tr [:lower:] [:upper:])"; fi
VALUE=$(echo $line | cut -d' ' -f2-)
echo "$NAME=$VALUE" >> $GITHUB_ENV
done < ${{inputs.filename}}

0 comments on commit 9276588

Please sign in to comment.