A GitHub action for replacing the values in json with GitHub secrets. It can be used for accepting the instructions on providing specific credentials for shell script in the job, via GitHub workflow inputs.
-
cd .github/actions/override-with-secrets-action
-
(optional) make required changes in .github/actions/override-with-secrets-action/src/index.js
-
npm i
-
npm run build
-
push the newly generated .github/actions/override-with-secrets-action/dist/index.js
Code snippet for using the action in workflow
- name: Checkout Source
with:
persist-credentials: false
uses: actions/checkout@v3
- name: aws-ssm-to-env
uses: ./.github/actions/override-with-secrets-action
with:
jsonString: '{
"ADMIN_PASSWORD": "placeholder",
"ANOTHER_PASSWORD": "placeholder",
}',
value: ${{ secrets.ADMINPASS }}
- name: log envs
env:
output_secrets_override: ${{ env.output_secrets_override }}
run: |
echo $output_secrets_override