GitHub Action to clone a repository, read a properties.env file, and expose it as usable JSON across jobs.
This custom action allows you to:
- Clone another repository.
- Read a
properties.envfile from a specific branch. - Convert the contents of the
properties.envfile into JSON. - Expose it as an
outputto be consumed usingfromJSON(...)in other jobs.
Ideal for sharing configurations across repositories.
| Name | Required | Description |
|---|---|---|
repo |
β | Repository to clone the properties.env from (e.g., org/repo). |
ref |
β | Branch or tag of the repo (e.g., main, v1.0.0). |
github_token |
β | Token with read access to the repository. |
env_path |
β | Path to the properties.env file within the repo (default: properties.env). |
| Name | Description |
|---|---|
env-json |
The contents of the properties.env file converted to JSON |
jobs:
get-env:
uses: Varomegar/env-json-exporter@v1
with:
repo: your-org/config-repo
ref: main
github_token: ${{ secrets.GH_TOKEN }}
env_path: config/properties.env
use-env:
runs-on: ubuntu-latest
needs: get-env
steps:
- name: Show variables
run: |
echo "EXAMPLE_VARS: ${{ fromJSON(needs.get-env.outputs.env-json).EXAMPLE_VARS }}"