From e48e93ecdfe91869ca45ccb52ae1d7eeaad9042f Mon Sep 17 00:00:00 2001 From: DEEP MEHTA Date: Mon, 23 Nov 2020 19:20:09 +0530 Subject: [PATCH] Add action definition file --- action.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 action.yml diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..1a78d92 --- /dev/null +++ b/action.yml @@ -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) \ No newline at end of file