Skip to content

GitHub Action for generating a json from env variables

License

Notifications You must be signed in to change notification settings

coolusaHD/json-from-env

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

JSON from Environment Variables GitHub Action

GitHub Super-Linter CI version

This GitHub Action creates a JSON file from environment variables.

Inputs

file-path (required)

File path ending with the new generated file .json.

entity-names (required)

Comma-separated string of entity names.

entity-values (required)

Comma-separated string of entity values.

Usage

Change [version] to the latest version of this GitHub Action.

name: Generate JSON

on:
  push:
    branches:
      - main

jobs:
  generate-json:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Generate JSON
        id: generate-json
        uses: coolusaHD/json-from-env@[version]
        with:
          file-path: 'output.json'
          entity-names: 'name1,NAME_2,NAME_3'
          entity-values: 'value1,VALUE_2,${{ secrets.NAME_3 }}'

      - name: Upload JSON Artifact
        uses: actions/upload-artifact@v3
        with:
          name: generated-json
          path: output.json

Example Workflow

The example workflow demonstrates how to use this GitHub Action to generate a JSON file based on your environment variables.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contribution

Contributions are welcome! Create a fork of this project, commit your changes and open a pull request.

About

GitHub Action for generating a json from env variables

Topics

Resources

License

Stars

Watchers

Forks