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.
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:
{
"auto": {
// prefixed to the variables in this collection
"enabled": true, // Should this section be used
"vars": {
// stores all the variables
"branch": "auto-update"
}
}
}
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.
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}}"
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}}"