https://github.com/antifree/json-to-variables
GitHub action reads JSON file and writes its content as environment variables.
https://github.com/antifree/json-to-variables
actions json variables
Last synced: 5 months ago
JSON representation
GitHub action reads JSON file and writes its content as environment variables.
- Host: GitHub
- URL: https://github.com/antifree/json-to-variables
- Owner: antifree
- License: mit
- Created: 2021-01-14T22:22:47.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-26T17:39:21.000Z (about 1 year ago)
- Last Synced: 2025-10-18T08:35:39.228Z (8 months ago)
- Topics: actions, json, variables
- Language: JavaScript
- Homepage:
- Size: 1.13 MB
- Stars: 23
- Watchers: 3
- Forks: 23
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# JSON to variables
This action reads json file and writes its content as environment variables.
## Inputs
### `filename`
**Required** The JSON file.
### `prefix`
(Optional) the prefix for all variables. Default value is empty string.
### `has_secrets`
(Optional) Identifies whether file has variables considered as secrets. If `true` - adds all variables to github secrets to be masked in logs. Default value `false`
## Usage
### File content
```json
{
"value": "value",
"array": [
{
"value": "value 0"
},
"value 1"
],
"obj": {
"value1": "value1",
"value2": "value2"
}
}
```
### YML example
```yml
- name: JSON to variables
uses: antifree/json-to-variables@v1.3.0 # x-release-please-version
with:
filename: 'test.json'
prefix: 'test'
has_secrets: true
- name: Show output
run: echo "The time was ${{ env.test_value }}, ${{ env.test_array_0_value }}, ${{ env.test_obj_value1 }}"
```