antifree / json-to-variables

GitHub action reads JSON file and writes its content as environment variables.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON to variables

This action reads json file and writes its content as environment variables.

Inputs

filename

Required The JSON file.

prefix

The prefix (optional). Default value is empty string.

Usage

File content

{
    "value": "value",
    "array": [
        {
            "value": "value 0"
        },
        "value 1"
    ],
    "obj": {
        "value1": "value1",
        "value2": "value2"
    }
}

YML example

- name: JSON to variables
  uses: antifree/json-to-variables@v1.2.0 # x-release-please-version
  with:
    filename: 'test.json'
    prefix: 'test'
- name: Show output
  run: echo "The time was ${{ env.test_value }}, ${{ env.test_array_0_value }}, ${{ env.test_obj_value1 }}"

About

GitHub action reads JSON file and writes its content as environment variables.

License:MIT License


Languages

Language:JavaScript 100.0%