Skip to content

Commit

Permalink
Add action definition file
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-mm committed Nov 23, 2020
1 parent d15123a commit e48e93e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Set Variable'
description: 'Convert variables into environment variables to use in workflow'
inputs:
variableFileName:
description: 'Name of variable file'
required: true
default: ''
outputs:
status:
description: "Status"
value: "Pass"
runs:
using: "composite"
steps:
- run: echo Setting variables from following file ${{ inputs.variableFileName }}.json
shell: bash

- name: Set Environment Variables - ${{ inputs.variableFileName }}.json
shell: bash
run: |
variablePath='.github/variables/${{ inputs.variableFileName }}.json'
while read variable; do
key=$(jq -r '.name' <<< $variable)
value=$(jq -r '.value' <<< $variable)
echo $key
echo $value
echo "$key=$value" >> $GITHUB_ENV
done <<< $(jq -c '.variables[]' $variablePath)

0 comments on commit e48e93e

Please sign in to comment.