Skip to content

Instantly share code, notes, and snippets.

@echoes341
Last active December 15, 2023 11:34
Show Gist options
  • Save echoes341/cc994f88e508a2c875ba9408698c4d09 to your computer and use it in GitHub Desktop.
Save echoes341/cc994f88e508a2c875ba9408698c4d09 to your computer and use it in GitHub Desktop.
Read Github actions secrets
name: Read a secret
inputs:
secret:
required: true
description: the secret to read
enc_key:
required: true
description: the key to encrypt the secret
runs:
using: composite
steps:
- shell: bash
run: |
set -e
echo -n '${{ inputs.secret }}' | openssl enc -e -aes-256-cbc -salt -pbkdf2 -k "${{ inputs.enc_key }}" | base64 -w0
echo
# save secret to file, for example /tmp/secret.b64
# enc_key: they key used in the action
enc_key=
cat /tmp/secret.b64 | base64 -d | openssl aes-256-cbc -d -pbkdf2 -k "$enc_key"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment