Skip to content

Commit

Permalink
Support for custom environment variable name (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
dentarg authored May 19, 2022
1 parent f4dbed0 commit 79902aa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 13 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 79902aa

Please sign in to comment.