Created
August 31, 2024 12:59
-
-
Save freddie-freeloader/41883f56539716105628a9779ebbf332 to your computer and use it in GitHub Desktop.
Check if AWS S3 credentials are available in a Github workflow
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: Check Secrets | |
on: | |
workflow_call: | |
inputs: | |
stub: | |
required: false | |
type: string | |
default: "stub" | |
secrets: | |
S3_BUCKET: | |
required: true | |
S3_DEPLOY_ID: | |
required: true | |
S3_DEPLOY_KEY: | |
required: true | |
S3_REGION: | |
required: true | |
jobs: | |
test-secrets-accessable: | |
name: Test secrets accessable | |
runs-on: ubuntu-latest | |
environment: Actions | |
env: | |
BUCKET_NAME: ${{ secrets.S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DEPLOY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DEPLOY_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.S3_REGION }} | |
steps: | |
# Check whether | |
- name: Test secrets accessable | |
run: echo ${BUCKET_NAME} | sed -e 's/\(.\)/\1 /g' | |
- name: Check deploy secrets | |
run: if [ -z ${AWS_ACCESS_KEY_ID+x} ]; then echo "access key is unset"; else echo "access key is set with length ${#AWS_ACCESS_KEY_ID}"; fi | |
- name: Check deploy secrets | |
run: if [ -z ${AWS_SECRET_ACCESS_KEY+x} ]; then echo "secret key is unset"; else echo "secret key is set with length ${#AWS_DEFAULT_REGION}"; fi | |
- name: Check deploy secrets | |
run: if [ -z ${AWS_DEFAULT_REGION+x} ]; then echo "region is unset"; else echo "region is set with length ${#AWS_DEFAULT_REGION}"; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment