Skip to content

Commit

Permalink
ci file
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Nov 1, 2023
1 parent 2e40a75 commit cb0f311
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/update_prisma_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Update Prisma Schema

on:
schedule:
# Runs every 30 minutes
- cron: "*/5 * * * *"

jobs:
update-schema:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16"

- name: Install pnpm
run: npm install -g pnpm

- name: Update Prisma Schema
run: npx prisma db pull
working-directory: packages/api

- name: Regenerate Prisma Client
run: npx prisma generate
working-directory: packages/api

- name: Check if there are changes
id: git-check
run: |
git diff --exit-code || echo "::set-output name=changes_detected::true"
- name: Commit changes
if: steps.git-check.outputs.changes_detected == 'true'
run: |
git config --global user.name 'Panora-Prisma Updates Bot'
git add .
git commit -m "Update Prisma schema"
- name: Create Pull Request
if: steps.git-check.outputs.changes_detected == 'true'
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GH_TOKEN }}
commit-message: Update Prisma schema
title: "chore: Update Prisma schema"
body: "This PR was auto-generated by GitHub Actions & Panora-Prisma."
branch: "update-prisma-schema-${{ github.run_id }}"

- name: Auto-merge Pull Request
if: steps.git-check.outputs.changes_detected == 'true'
uses: pascalgn/[email protected]
with:
token: ${{ secrets.GH_TOKEN }}
mergeMethod: squash
commitMessage: "chore: Update Prisma schema"
pullRequestFilterLabels: "auto-merge"
requiredLabels: "auto-merge"
blockingLabels: "do not merge"
requiredChecks: "release,build-api (16.x)"

0 comments on commit cb0f311

Please sign in to comment.