From 1efca91fcf1d67e3cdf1886a14c2886ebdba2524 Mon Sep 17 00:00:00 2001 From: leiicamundi <153937047+leiicamundi@users.noreply.github.com> Date: Wed, 6 Mar 2024 14:04:39 +0100 Subject: [PATCH] fix export vars --- .github/workflows/check-unused-resources.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-unused-resources.yml b/.github/workflows/check-unused-resources.yml index c237a44c..09952cf3 100644 --- a/.github/workflows/check-unused-resources.yml +++ b/.github/workflows/check-unused-resources.yml @@ -58,16 +58,19 @@ jobs: PGUSER="keycloak-irsa" PGPASSWORD="${{ steps.secrets.outputs.AURORA_POSTGRESQL_PASSWORD }}" + + export PGPASSWORD + export PGPORT + export PGUSER + export PGHOST + export PGDATABASE + export RETENTION_INTERVAL + user_exists="$(psql -U "${{ steps.secrets.outputs.AURORA_POSTGRESQL_USERNAME }}" -d "$PGDATABASE" -tAc "SELECT 1 FROM pg_roles WHERE rolname='$PGUSER'")" if [ "$user_exists" = "1" ]; then PGPASSWORD="$(aws rds generate-db-auth-token --hostname "${PGHOST}" --port "${PGPORT}" --region "${AWS_REGION}" --username "${PGUSER}")" export PGPASSWORD - export PGPORT - export PGUSER - export PGHOST - export PGDATABASE - export RETENTION_INTERVAL bash ./.helpers/actions/drop-unused-db.sh else echo "The user ${PGUSER} does not exist, skipping."