Skip to content

cssnr/env-json-action

Repository files navigation

GitHub Tag Major GitHub Tag Minor GitHub Release Version GitHub Dist Size Workflow Release Workflow Test Workflow Lint Quality Gate Status GitHub Last Commit Codeberg Last Commit GitHub Contributors GitHub Repo Size GitHub Top Language GitHub Discussions GitHub Forks GitHub Repo Stars GitHub Org Stars Discord Ko-fi

Environment to or from JSON Action

Convert Environment File, Data or Keys, to or from, JSON Data or File.

Also allows masking the data as secret (only viable for source files since inputs are exposed).

Note

Please submit a Feature Request for new features or Open an Issue if you find any bugs.

Inputs

Input Default Description of Input
source-data Required Source Data or File Path
source-type json Source Type: [json, env]
output-type Opposite Output Type: [json, env]
output-file - Optional File to Write Output Data
sensitive false Mark Output Data as Sensitive
summary true Add Summary to Job

source-data

Source Environment or JSON Data or File Path.

Previously: source

source-type

Source Data Type, one of: [json, env]

Previously: type

output-type

Output Data Type,defaults to the opposite of source-type, one of: [json, env]

Previously: output

output-file

Optional File Path to Write the Output Data.

Previously: file

sensitive

Set to true if data is sensitive and should be masked.
This will mask the data as a whole, plus every individual value.

summary

Write a Summary for the job. To disable this set to false.

👀 View Example Summary

💾 ✔️ .github/test/results.json

Results
{ "VAR1": "success", "VAR2": "2" }
Inputs
InputValue
source.github/test/test.env
typejson
dest.github/test/results.json
sensitivefalse
summarytrue

To see a workflow run you can view a recent test.yaml run (requires login).

- name: 'Parse Environment'
  uses: cssnr/env-json-action@master
  with:
    source-data: test.env

Outputs

Output Description
result JSON or Environment Results
- name: 'Parse Environment'
  id: parse
  uses: cssnr/env-json-action@master
  with:
    source-data: test.env

- name: 'Echo Result'
  run: echo '${{ steps.parse.outputs.result }}'

Examples

There are some more examples in the test workflow: .github/workflows/test.yaml

For more examples, you can check out other projects using this action:
https://github.com/cssnr/env-json-action/network/dependents

Tags

The following rolling tags are maintained.

Version Tag Rolling Bugs Feat. Name Target Example
GitHub Tag Major Major vN.x.x vN
GitHub Tag Minor Minor vN.N.x vN.N
GitHub Release Micro vN.N.N vN.N.N

You can view the release notes for each version on the releases page.

The Major tag is recommended. It is the most up-to-date and always backwards compatible. Breaking changes would result in a Major version bump. At a minimum you should use a Minor tag.

Support

For general help or to request a feature see:

If you are experiencing an issue/bug or getting unexpected results you can:

For more information, see the CSSNR SUPPORT.md.

Contributing

Please consider making a donation to support the development of this project and additional open source projects.

Ko-fi

If you would like to submit a PR, please review the CONTRIBUTING.md.

Additionally, you can support other GitHub Actions I have published:

❔ Unpublished Actions

These actions are not published on the Marketplace, but may be useful.


📝 Template Actions

These are basic action templates that I use for creating new actions.

Note: The docker-test-action builds, runs and pushes images to GitHub Container Registry.


For a full list of current projects visit: https://cssnr.github.io/

About

Convert Environment File, Data or Keys, to or from, JSON Data or File

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project