Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ key features:

#### Outputs

| Key | Description | Example |
|------------------|--------------------------------------------------|-----------------------------------------------------|
| connection-uri | The connection URI to connect to PostgreSQL. | `postgresql://postgres:postgres@localhost/postgres` |
| service-name | The service name with connection parameters. | `postgres` |
| certificate-path | The path to the server certificate if SSL is on. | `/home/runner/work/_temp/pgdata/server.crt` |
| Key | Description | Example |
|------------------|--------------------------------------------------|-----------------------------------------------------------------------|
| connection-uri | The connection URI to connect to PostgreSQL. | `postgresql://postgres:postgres@localhost/postgres` |
| service-name | The service name with connection parameters. | `postgres` |
| certificate-path | The path to the server certificate if SSL is on. | `$RUNNER_TEMP/action-setup-postgres/$GITHUB_ACTION/pgdata/server.crt` |

#### User permissions

Expand Down
7 changes: 4 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ runs:

- name: Setup and start PostgreSQL
run: |
PGDATA="$RUNNER_TEMP/pgdata"
PWFILE="$RUNNER_TEMP/pwfile"
PGDATA="$RUNNER_TEMP/action-setup-postgres/$GITHUB_ACTION/pgdata"
PWFILE="$RUNNER_TEMP/action-setup-postgres/$GITHUB_ACTION/pwfile"
mkdir -p "$RUNNER_TEMP/action-setup-postgres/$GITHUB_ACTION"

DEFAULT_ENCODING="UTF-8"
DEFAULT_LOCALE="en_US.$DEFAULT_ENCODING"
Expand Down Expand Up @@ -258,7 +259,7 @@ runs:
PASSWORD_ENCODED=$(jq -rn --arg s "$INPUT_PASSWORD" '$s|@uri')
DATABASE_ENCODED=$(jq -rn --arg s "$INPUT_DATABASE" '$s|@uri')
CONNECTION_URI="postgresql://$USERNAME_ENCODED:$PASSWORD_ENCODED@localhost:$INPUT_PORT/$DATABASE_ENCODED"
CERTIFICATE_PATH="$RUNNER_TEMP/pgdata/server.crt"
CERTIFICATE_PATH="$RUNNER_TEMP/action-setup-postgres/$GITHUB_ACTION/pgdata/server.crt"

if [ "$INPUT_SSL" = "true" ]; then
# Although SSLMODE and SSLROOTCERT are specific to libpq options,
Expand Down
5 changes: 3 additions & 2 deletions tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ def test_environment_variables(is_windows: bool):
# In case of Windows, there might be a mix of forward and backward slashes
# as separators. So let's compare paths semantically instead.
pg_servicefile = pathlib.Path(pg_environ.pop("PGSERVICEFILE", ""))
pg_servicefile_exp = pathlib.Path(os.environ["RUNNER_TEMP"], "pgdata", "pg_service.conf")
assert pg_servicefile.resolve() == pg_servicefile_exp.resolve()
runner_temp = pathlib.Path(os.environ["RUNNER_TEMP"])
pg_servicefile_rel = pg_servicefile.resolve().relative_to(runner_temp.resolve())
assert pg_servicefile_rel.full_match("action-setup-postgres/*/pgdata/pg_service.conf")

if is_windows:
pg_environ_exp = {
Expand Down