update unlock vault

This commit is contained in:
Johan Rooijakkers 2025-02-26 15:57:45 +01:00
parent 59a801a15f
commit 445f3224bd

View File

@ -33,8 +33,23 @@ runs:
- name: Unlock Vault - name: Unlock Vault
shell: sh shell: sh
run: | run: |
bw login --apikey # Ensure Bitwarden is logged in
echo "BW_SESSION=$(bw unlock '${{ inputs.password }}' --raw)" >> $GITHUB_ENV if ! bw login --check; then
bw login --apikey
fi
# Unlock the vault and store the session key
BW_SESSION=$(bw unlock "${{ inputs.password }}" --raw)
# Verify if BW_SESSION is set correctly
if [ -n "$BW_SESSION" ]; then
echo "BW_SESSION=$BW_SESSION" >> "$GITHUB_ENV"
export BW_SESSION
echo "✅ Vault unlocked successfully!"
else
echo "❌ Failed to unlock Bitwarden vault"
exit 1
fi
env: env:
BW_CLIENTID: ${{ inputs.client-id }} BW_CLIENTID: ${{ inputs.client-id }}
BW_CLIENTSECRET: ${{ inputs.client-secret }} BW_CLIENTSECRET: ${{ inputs.client-secret }}
@ -42,7 +57,6 @@ runs:
- name: Retrieve Requested Secrets - name: Retrieve Requested Secrets
shell: sh shell: sh
run: | run: |
# Convert comma-separated secrets into a list
OLDIFS=$IFS OLDIFS=$IFS
IFS=',' IFS=','
set -- ${{ inputs.secrets }} set -- ${{ inputs.secrets }}