-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
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)" |