Skip to content

Commit

Permalink
feat: output password (#38)
Browse files Browse the repository at this point in the history
* feat: output password

* fix: self review
  • Loading branch information
aldenquimby authored Nov 10, 2023
1 parent 863b797 commit 6cd02f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ outputs:
branch_id:
description: 'New branch id'
value: ${{ steps.create-branch.outputs.branch_id }}
password:
description: 'Password for connecting to the new branch database with the input username'
value: ${{ steps.create-branch.outputs.password }}
```
## How to set up the NEON_API_KEY
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ outputs:
branch_id:
description: 'New branch id'
value: ${{ steps.create-branch.outputs.branch_id }}
password:
description: 'Password for connecting to the new branch database with the input username'
value: ${{ steps.create-branch.outputs.password }}

runs:
using: 'composite'
Expand Down Expand Up @@ -86,6 +89,7 @@ runs:
NEON_CS=$(neonctl cs ${branch_id} --project-id ${{ inputs.project_id }} --role-name ${{ inputs.username }} --database-name ${{ inputs.database }} --prisma ${{ inputs.prisma }} --extended -o json)
DB_URL=$(echo $NEON_CS | jq -r '.connection_string')
DB_HOST=$(echo $NEON_CS | jq -r '.host')
DB_PASSWORD=$(echo $NEON_CS | jq -r '.password')
NEON_CS_POOLER=$(neonctl cs ${branch_id} --project-id ${{ inputs.project_id }} --role-name ${{ inputs.username }} --database-name ${{ inputs.database }} --pooled --prisma ${{ inputs.prisma }} --extended -o json)
DB_URL_WITH_POOLER=$(echo $NEON_CS_POOLER | jq -r '.connection_string')
DB_HOST_WITH_POOLER=$(echo $NEON_CS_POOLER | jq -r '.host')
Expand All @@ -106,11 +110,13 @@ runs:
NEON_CS=$(neonctl cs ${branch_id} --project-id ${{ inputs.project_id }} --role-name ${{ inputs.username }} --database-name ${{ inputs.database }} --prisma ${{ inputs.prisma }} --extended -o json)
DB_URL=$(echo $NEON_CS | jq -r '.connection_string')
DB_HOST=$(echo $NEON_CS | jq -r '.host')
DB_PASSWORD=$(echo $NEON_CS | jq -r '.password')
NEON_CS_POOLER=$(neonctl cs ${branch_id} --project-id ${{ inputs.project_id }} --role-name ${{ inputs.username }} --database-name ${{ inputs.database }} --pooled --prisma ${{ inputs.prisma }} --extended -o json)
DB_URL_WITH_POOLER=$(echo $NEON_CS_POOLER | jq -r '.connection_string')
DB_HOST_WITH_POOLER=$(echo $NEON_CS_POOLER | jq -r '.host')
fi
echo "db_url=${DB_URL}" >> $GITHUB_OUTPUT
echo "db_url_with_pooler=${DB_URL_WITH_POOLER}" >> $GITHUB_OUTPUT
echo "password=${DB_PASSWORD}" >> $GITHUB_OUTPUT
echo "host=${DB_HOST}" >> $GITHUB_OUTPUT
echo "host_with_pooler=${DB_HOST_WITH_POOLER}" >> $GITHUB_OUTPUT

0 comments on commit 6cd02f5

Please sign in to comment.