Merge pull request 'Changes workflow to not write the .env to its own variable to avoid a bug caused by gitea's runner exposing env vars' (#4) from fix/changes-env-file-handling into main
Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
+15
-4
@@ -22,6 +22,10 @@ inputs:
|
|||||||
secrets:
|
secrets:
|
||||||
description: "List of secret IDs and corresponding environment variable names (format: 'SECRET_ID > ENV_VAR')"
|
description: "List of secret IDs and corresponding environment variable names (format: 'SECRET_ID > ENV_VAR')"
|
||||||
required: true
|
required: true
|
||||||
|
dot-env-path:
|
||||||
|
description: "Path to write the DOT_ENV secret to instead of exporting it via GITHUB_ENV"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
@@ -55,10 +59,17 @@ runs:
|
|||||||
SECRET_VALUE=$(bw get notes "$SECRET_ID" --session "$BW_SESSION" --raw 2>/dev/null)
|
SECRET_VALUE=$(bw get notes "$SECRET_ID" --session "$BW_SESSION" --raw 2>/dev/null)
|
||||||
|
|
||||||
if [ -n "$SECRET_VALUE" ]; then
|
if [ -n "$SECRET_VALUE" ]; then
|
||||||
echo "$ENV_VAR<<EOF" >> $GITHUB_ENV
|
if [ "$ENV_VAR" = "DOT_ENV" ] && [ -n "${{ inputs.dot-env-path }}" ]; then
|
||||||
echo "$SECRET_VALUE" >> $GITHUB_ENV
|
mkdir -p "$(dirname "${{ inputs.dot-env-path }}")"
|
||||||
echo "EOF" >> $GITHUB_ENV
|
umask 077
|
||||||
echo "Stored $SECRET_ID in $ENV_VAR"
|
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"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Failed to retrieve secret: $SECRET_ID"
|
echo "Failed to retrieve secret: $SECRET_ID"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user