From 79902aacfedff248ab5af2e384f030f6381a4636 Mon Sep 17 00:00:00 2001 From: Patrik Ragnarsson Date: Thu, 19 May 2022 17:15:23 +0200 Subject: [PATCH] Support for custom environment variable name (#1) --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 14 +++++++++++++- action.yml | 7 ++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd3774b..ba0194c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - run: git push origin HEAD:v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3a0cd90..bdabb6f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,10 +19,22 @@ jobs: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: psql --version - uses: ./ - run: pg_isready --dbname=$POSTGRES_URL - run: psql --command='CREATE TABLE tbl()' $POSTGRES_URL - run: psql --command='\d' $POSTGRES_URL - run: psql --command='SELECT * FROM pg_available_extensions' $POSTGRES_URL + test_custom_env: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./ + with: + env-key: DATABASE_URL + - run: pg_isready --dbname=$DATABASE_URL + - run: psql --command='CREATE TABLE tbl()' $DATABASE_URL + - run: psql --command='\d' $DATABASE_URL + - run: psql --command='SELECT * FROM pg_available_extensions' $DATABASE_URL diff --git a/action.yml b/action.yml index ab6c6f2..e831c1a 100644 --- a/action.yml +++ b/action.yml @@ -3,6 +3,11 @@ description: "Start PostgreSQL in the GitHub Actions VM" branding: icon: "save" color: "orange" +inputs: + env-key: + description: "Name of the environment variable with the Postgres URL" + required: false + default: "POSTGRES_URL" runs: using: "composite" steps: @@ -18,5 +23,5 @@ runs: - run: createdb ${USER} shell: bash - - run: echo "POSTGRES_URL=postgres://localhost/${USER}" >> $GITHUB_ENV + - run: echo "${{ inputs.env-key }}=postgres://localhost/${USER}" >> $GITHUB_ENV shell: bash