https://github.com/guillaumefalourd/convert-json-to-env
Github Actions to convert variables from a JSON file to workflow ENV variables :octocat:
https://github.com/guillaumefalourd/convert-json-to-env
convert env github-actions json
Last synced: 8 months ago
JSON representation
Github Actions to convert variables from a JSON file to workflow ENV variables :octocat:
- Host: GitHub
- URL: https://github.com/guillaumefalourd/convert-json-to-env
- Owner: GuillaumeFalourd
- License: apache-2.0
- Created: 2022-04-22T19:37:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-07T18:09:08.000Z (about 3 years ago)
- Last Synced: 2025-02-01T15:20:42.749Z (9 months ago)
- Topics: convert, env, github-actions, json
- Language: Python
- Homepage: https://github.com/marketplace/actions/convert-json-to-env
- Size: 39.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Convert JSON to ENV
[](https://github.com/search?o=desc&q=GuillaumeFalourd+convert-json-to-env+path%3A.github%2Fworkflows+language%3AYAML&s=&type=Code) [](https://github.com/GuillaumeFalourd/convert-json-to-env/actions/workflows/ubuntu_action_test.yml) [](https://github.com/GuillaumeFalourd/convert-json-to-env/actions/workflows/macos_action_test.yml) [](https://github.com/GuillaumeFalourd/convert-json-to-env/actions/workflows/windows_action_test.yml)

☞ Github Actions to convert variables from a JSON file to workflow ENV variables :octocat:
_**Note**: This action is supported on **all runners** operating systems (`ubuntu`, `macos`, `windows`)_
## 📚 Usage
### ⚠️ Requirements
- The [`actions/checkout`](https://github.com/marketplace/actions/checkout) is mandatory to use this action, as it will be necessary to access the JSON file.
- The `JSON` file currently only support one level variables. The **keys** will also be converted to UPPERCASE.
### Example
```yaml
steps:
- uses: actions/checkout@v2.3.4
- uses: GuillaumeFalourd/convert-json-to-env@v1
with:
json_file: ./config.json
- run: echo ${{ env.KEY1 }} #where "key1" is set on the config.json file
```### ▶️ Action Inputs
Field | Mandatory | Default Value | Observation
------------ | ------------ | ------------- | -------------
**json_file** | YES | N/A | Path to JSON file
_e.g: `./config.json` (when on root)_## 🤝 Contributing
☞ If you're interested in contributing to this repository, please follow the [guidelines](https://github.com/GuillaumeFalourd/convert-json-to-env/blob/main/CONTRIBUTING.md)
## 🏅 Licensed
☞ This repository uses the [Apache License 2.0](https://github.com/GuillaumeFalourd/convert-json-to-env/blob/main/LICENSE)