https://github.com/buka-inc/actions.json-to-env
Convert Json to env variables
https://github.com/buka-inc/actions.json-to-env
Last synced: 4 months ago
JSON representation
Convert Json to env variables
- Host: GitHub
- URL: https://github.com/buka-inc/actions.json-to-env
- Owner: buka-inc
- License: mit
- Created: 2024-12-01T15:50:55.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-01T16:58:36.000Z (7 months ago)
- Last Synced: 2025-02-19T12:53:06.925Z (4 months ago)
- Language: JavaScript
- Size: 256 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# actions.json-to-env
Converts a JSON string to environment variables.
And all key will be transform to CONSTANT_CASE by [change-case](https://www.npmjs.com/package/change-case).## Inputs
| **Argument** | **Required** | **Default** | **Description** |
| :----------- | :----------- | :---------- | :----------------------------------------------------- |
| json | true | - | The JSON string |
| prefix | false | `''` | The prefix of environment variable |
| separator | false | `'__'` | The separator to use between the parent and child keys |## Examples
```yaml
name: Exampleon: push
jobs:
test:
name: Example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
json: '{"pkg_a": {"version": "1.1.1"}, "pkgB": {"version": "9.9.9"}}'
prefix: "root"
- run: |
[[ $ROOT__PKG_A__VERSION == "1.1.1" ]] || exit 1
[[ $ROOT__PKG_B__VERSION == "9.9.9" ]] || exit 1
```