Created
April 5, 2023 21:35
-
-
Save bmorrisondev/1215f372a1a38608442ab0fbf4bb424d to your computer and use it in GitHub Desktop.
Creates a new branch & deploy request in PlanetScale when a PR is opened and schema.prisma is changed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Prisma PR PlanetScale Demo | |
on: | |
pull_request: | |
types: [opened] | |
paths: | |
- schema.prisma | |
env: | |
PLANETSCALE_ORG: bmorrison-ps | |
PLANETSCALE_DB: recipes_db | |
PLANETSCALE_SERVICE_TOKEN_ID: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_ID }} | |
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }} | |
jobs: | |
create_a_branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Create a branch | |
uses: planetscale/create-branch-action@v1 | |
id: create_branch | |
with: | |
org_name: ${{ env.PLANETSCALE_ORG }} | |
database_name: ${{ env.PLANETSCALE_DB }} | |
branch_name: ${{ github.event.pull_request.head.ref }} | |
wait: true | |
- name: Create a deploy request | |
uses: planetscale/create-deploy-request-action@v1 | |
id: create_deploy_request | |
with: | |
org_name: ${{ env.PLANETSCALE_ORG }} | |
database_name: ${{ env.PLANETSCALE_DB }} | |
branch_name: ${{ github.event.pull_request.head.ref }} | |
- name: Comment PR | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
Branch: https://app.planetscale.com/${{ env.PLANETSCALE_ORG }}/${{ env.PLANETSCALE_DB }}/${{ github.event.pull_request.head.ref }} | |
Deploy request: https://app.planetscale.com/${{ env.PLANETSCALE_ORG }}/${{ env.PLANETSCALE_DB }}/deploy-requests/${{ steps.create_deploy_request.outputs.number }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment