From 3a15c186e30c14a6ee40d3470471e78823bc186a Mon Sep 17 00:00:00 2001 From: Xiao Meng Date: Fri, 7 Jul 2023 12:23:38 +0800 Subject: [PATCH] fix wrong connection url passed to pg_dump, closes #1 also changes the definition of `supabase_url` from the database host to the connection URI, see https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING --- action.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/action.yaml b/action.yaml index 2a3c27d..bd0ce68 100644 --- a/action.yaml +++ b/action.yaml @@ -4,10 +4,7 @@ author: mansueli inputs: supabase_url: - description: 'The URL of your Supabase instance' - required: true - supabase_password: - description: 'The password for the Supabase instance' + description: 'The connection URL of your Supabase instance, formatted as postgresql://[userspec@][hostspec][/dbname][?paramspec]' required: true runs: @@ -21,10 +18,12 @@ runs: wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null sudo apt update sudo apt install postgresql-15 postgresql-client-15 -y - /usr/lib/postgresql/15/bin/pg_dump --clean --if-exists --quote-all-identifiers --schema '*' --exclude-schema 'extensions|graphql|graphql_public|net|pgbouncer|pgsodium|pgsodium_masks|realtime|supabase_functions|storage|pg_*|information_schema' -d postgres://postgres:${{ inputs.supabase_url }}@${{ inputs.supabase_password }}:6543/postgres > dump.sql + /usr/lib/postgresql/15/bin/pg_dump --clean --if-exists --quote-all-identifiers --schema '*' \ + --exclude-schema 'extensions|graphql|graphql_public|net|pgbouncer|pgsodium|pgsodium_masks|realtime|supabase_functions|storage|pg_*|information_schema' \ + -d {{ inputs.supabase_url }} > dump.sql - name: Tweaking the dump file - shell: bash + shell: bash run: | sed -i -e 's/^DROP SCHEMA IF EXISTS "auth";$/-- DROP SCHEMA IF EXISTS "auth";/' dump.sql sed -i -e 's/^DROP SCHEMA IF EXISTS "storage";$/-- DROP SCHEMA IF EXISTS "storage";/' dump.sql