Merge pull request 'fix/stop-showing-secrets' (#6) from fix/stop-showing-secrets into main

Reviewed-on: #6
This commit was merged in pull request #6.
This commit is contained in:
2026-04-17 13:53:47 +00:00
+9 -15
View File
@@ -21,8 +21,7 @@ inputs:
required: true
dot-env-path:
description: "Path to write the DOT_ENV secret to instead of exporting it via GITHUB_ENV"
required: false
default: ""
required: true
runs:
using: "composite"
@@ -31,19 +30,15 @@ runs:
shell: sh
run: bw config server "${{ inputs.server }}"
- name: Unlock Vault
- name: Unlock vault and retrieve secrets
shell: sh
run: |
bw login --apikey
BW_SESSION=$(bw unlock '${{ inputs.password }}' --raw)
echo "BW_SESSION=$BW_SESSION" >> $GITHUB_ENV
env:
BW_CLIENTID: "${{ inputs.client-id }}"
BW_CLIENTSECRET: "${{ inputs.client-secret }}"
- name: Retrieve Secrets
shell: sh
run: |
bw login --apikey
BW_SESSION=$(bw unlock '${{ inputs.password }}' --raw)
echo "${{ inputs.secrets }}" | while IFS='>' read SECRET_ID ENV_VAR; do
SECRET_ID=$(echo "$SECRET_ID" | sed 's/^ *//;s/ *$//')
ENV_VAR=$(echo "$ENV_VAR" | sed 's/^ *//;s/ *$//')
@@ -56,18 +51,17 @@ runs:
SECRET_VALUE=$(bw get notes "$SECRET_ID" --session "$BW_SESSION" --raw 2>/dev/null)
if [ -n "$SECRET_VALUE" ]; then
if [ "$ENV_VAR" = "DOT_ENV" ] && [ -n "${{ inputs.dot-env-path }}" ]; then
if [ "$ENV_VAR" = "DOT_ENV" ]; then
mkdir -p "$(dirname "${{ inputs.dot-env-path }}")"
umask 077
printf '%s\n' "$SECRET_VALUE" > "${{ inputs.dot-env-path }}"
echo "Stored $SECRET_ID in $ENV_VAR file"
else
echo "$ENV_VAR<<EOF" >> $GITHUB_ENV
echo "$SECRET_VALUE" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "Stored $SECRET_ID in $ENV_VAR"
echo "Unsupported ENV_VAR: $ENV_VAR"
exit 1
fi
else
echo "Failed to retrieve secret: $SECRET_ID"
exit 1
fi
done