Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Super-action for creating and updating workflow secrets, variables or outputs from inputs or config file!

License

Notifications You must be signed in to change notification settings

Resnovas/variable-mastermind

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

Manage Github Secrets

This action is built to support the production of github workflow templates, and provide functionality to pass data from secrets or files to workflow steps. This allows users to create complex workflows with complex environmental variables.

We use secrets in this to reduce the load on the API as another method we tried would cause the api to max out regularly.

Table of contents

Use this action

To get started with this action, create a file named allconfig.json or allconfig.yml and store your configuration variables within. For instance this is a valid file:

allconfig.json

{
  "auto": {
    // prefixed to the variables in this collection
    "enabled": true, // Should this section be used
    "vars": {
      // stores all the variables
      "branch": "auto-update"
    }
  }
}

allconfig.yml

auto: # prefixed to the variables in this collection
  enabled: true # Should this section be used
  vars: # stores all the variables
    branch: 'auto-update'

Using the action within a workflow can require a small bit of configuration, depending on the application. The following examples are created from our application Universal GitActions Workflows which is heavily based on this action.

Using Job Outputs

jobs:
  getConfigs:
    runs-on: ubuntu-latest
    outputs:
      setting: ${{steps.tests.outputs.test_setting}}} # By setting which outputs you want to use here you can use them in other jobs
    steps:
      - name: Manage Github Secrets
        uses: Videndum/[email protected]
        with:
          settings: ${{ secrets.SETTINGS }} # The secret containing your JSON settings string
          settingsjson: '.github/allconfigs.json' # The file storing the settings (can be JSON or YML)
          mode: 'output' # The mode to output vars - Options: output, environment, secret
          token: ${{ secrets.GITHUB_TOKEN }} # Your github token to allow access to the API if needed (only used as backup when secret.SETTINGS isn't valid)

  test-output: # make sure the action works on a clean machine without building
    runs-on: ubuntu-latest
    needs: getConfigs
    steps:
      - name: check output
        run: |
          echo "${{needs.getConfigs.outputs.setting}}"

Using Job Environment

jobs:
  getConfigs:
    runs-on: ubuntu-latest
    steps:
      - name: Manage Github Secrets
        uses: Videndum/[email protected]
        with:
          settings: ${{ secrets.SETTINGS }} # The secret containing your JSON settings string
          settingsjson: '.github/allconfigs.json' # The file storing the settings (can be JSON or YML)
          mode: 'environment' # The mode to output vars - Options: output, environment, secret
          token: ${{ secrets.GITHUB_TOKEN }} # Your github token to allow access to the API if needed (only used as backup when secret.SETTINGS isn't valid)
      - name: check env
        run: echo "${{env.test_setting}}"

About

Super-action for creating and updating workflow secrets, variables or outputs from inputs or config file!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •