-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
28 lines (27 loc) · 1 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
name: 'Set Variable'
description: 'Convert your variables.json file in .github/variables into environment variables to be used within the scope of a job.'
inputs:
variableFileName:
description: 'Name of variable file. File must be of format {"variables": [{"name": "variable1","value": "variable1value"}]}'
required: true
default: 'variable'
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)