Basically its not possible to use pscale CLI within github action. In this example im using create-deploy-request function in ps-create-helper-functions.sh
As you can see below, the user gets authenticated, however requests for authentication anyways
jobs:
deploy-planetscale:
name: Planetscale deploy
runs-on: ubuntu-latest
#container: node:latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: Apply database migrations in pre-deploy database branch
timeout-minutes: 3
# - shell: bash
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
PLANETSCALE_SERVICE_TOKEN_ID: ${{secrets.PLANETSCALE_SERVICE_TOKEN_ID}}
PLANETSCALE_SERVICE_TOKEN_NAME: ${{secrets.PLANETSCALE_SERVICE_TOKEN_NAME}}
PLANETSCALE_SERVICE_TOKEN: ${{secrets.PLANETSCALE_SERVICE_TOKEN}}
ORG_NAME: ${{secrets.ORG_NAME}}
DB_NAME: ${{secrets.DB_NAME}}
BRANCH_NAME: pre-deploy
run: |
./scripts/deploy-database-staging.sh
#!/bin/bash
. ./scripts/planetscale-docker-image.sh
unset PLANETSCALE_SERVICE_TOKEN
. ./scripts/authenticate-planetscale.sh
#npm i -g prisma >3
#prisma db push --skip-generate
. ./scripts/planetscale-helper-functions.sh
create-deploy-request "$DB_NAME" "$BRANCH_NAME" "$ORG_NAME"
create-deployment "$DB_NAME" "$ORG_NAME" "$DEPLOY_REQUEST_NUMBER"