Ability to save data to file #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "e2e" | |
on: | |
push: | |
branches: | |
- main | |
- "releases/*" | |
jobs: | |
test-exclude: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Export secrets to env variables (with exclude) | |
uses: ./ | |
with: | |
secrets: ${{ toJSON(secrets) }} | |
exclude: non-existent,SECRET_2 | |
env: | |
SECRET_1: 1234 # Should show override warning | |
- name: Verify secrets to env variables (with exclude) | |
run: | | |
[[ "${SECRET_1}" != "VALUE_1" ]] && echo "Could not export SECRET_1 secret, value is ${SECRET_1}" && exit 1 | |
[[ "${SECRET_2}" != "" ]] && echo "SECRET_2 should be unset, got ${SECRET_2}" && exit 1 | |
[[ "${SECRET_3}" != "VALUE_3" ]] && echo "Could not export SECRET_3 secret, value is ${SECRET_3}" && exit 1 | |
true | |
shell: bash | |
test-include-prefix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Export secrets to env variables (with prefix, include) | |
uses: ./ | |
with: | |
prefix: PREF_ | |
secrets: ${{ toJSON(secrets) }} | |
include: non-existent, SECRET_1 | |
- name: Verify secrets to env variables (with prefix, include) | |
run: | | |
[[ "${SECRET_1}" != "" ]] && echo "SECRET_1 should be unset, got ${SECRET_1}" && exit 1 | |
[[ "${PREF_SECRET_1}" != "VALUE_1" ]] && echo "Could not export SECRET_1 secret, value is ${SECRET_1}" && exit 1 | |
[[ "${SECRET_2}" != "" ]] && echo "SECRET_2 should be unset, got ${SECRET_2}" && exit 1 | |
[[ "${SECRET_3}" != "" ]] && echo "SECRET_3 should be unset, got ${SECRET_3}" && exit 1 | |
[[ "${PREF_SECRET_2}" != "" ]] && echo "PREF_SECRET_2 should be unset, got ${PREF_SECRET_2}" && exit 1 | |
[[ "${PREF_SECRET_3}" != "" ]] && echo "PREF_SECRET_3 should be unset, got ${PREF_SECRET_3}" && exit 1 | |
true | |
shell: bash | |
test-override: | |
runs-on: ubuntu-latest | |
env: | |
SECRET_1: DONT_OVERRIDE | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Export secrets to env variables (override) | |
uses: ./ | |
with: | |
override: false | |
secrets: ${{ toJSON(secrets) }} | |
- name: Verify secrets to env variables (override) | |
run: | | |
[[ "${SECRET_1}" != "DONT_OVERRIDE" ]] && echo "Override test failed" && exit 1 | |
true | |
shell: bash | |
test-convert: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Export secrets to env variables (convert) | |
uses: ./ | |
with: | |
convert: pascal | |
secrets: ${{ toJSON(secrets) }} | |
- name: Verify secrets to env variables (convert) | |
run: | | |
[[ "${Secret_1}" != "VALUE_1" ]] && echo "Could not export Secret_1 secret, value is ${Secret_1}" && exit 1 | |
[[ "${Secret_2}" != "VALUE_2" ]] && echo "Could not export Secret_2 secret, value is ${Secret_2}" && exit 1 | |
[[ "${Secret_3}" != "VALUE_3" ]] && echo "Could not export Secret_3 secret, value is ${Secret_3}" && exit 1 | |
true | |
shell: bash | |
test-convert-prefix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Export secrets to env variables (starts with, include) | |
uses: ./ | |
with: | |
prefix: MY_ | |
convert_prefix: false | |
convert: lower | |
secrets: ${{ toJSON(secrets) }} | |
- name: Verify secrets to env variables (starts with, include) | |
run: | | |
[[ "${MY_secret_1}" != "VALUE_1" ]] && echo "Could not export MY_secret_1 secret, value is ${MY_secret_1}" && exit 1 | |
[[ "${MY_secret_2}" != "VALUE_2" ]] && echo "Could not export MY_secret_2 secret, value is ${MY_secret_2}" && exit 1 | |
[[ "${MY_secret_3}" != "VALUE_3" ]] && echo "Could not export MY_secret_3 secret, value is ${MY_secret_3}" && exit 1 | |
true | |
shell: bash | |
# These jobs always fail, for now we just use it to check if the output is the expected | |
test-errors: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bad secrets | |
uses: ./ | |
with: | |
secrets: asdf | |
continue-on-error: true | |
- name: Bad convert value | |
uses: ./ | |
with: | |
convert: bad | |
secrets: ${{ toJSON(secrets) }} | |
continue-on-error: true |