-
Notifications
You must be signed in to change notification settings - Fork 195
76 lines (64 loc) · 2.16 KB
/
update_prisma_schema.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Update Prisma Schema
on:
push:
branches:
- main
#schedule:
# Runs every 30 minutes
#- cron: "*/2 * * * *"
jobs:
update-schema:
permissions:
contents: write
issues: write
pull-requests: write
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
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: Install dependencies
run: pnpm --recursive install --no-frozen-lockfile
- 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.GITHUB_TOKEN }}
mergeMethod: squash
commitMessage: "chore: Update Prisma schema"
pullRequestFilterLabels: "auto-merge"
requiredLabels: "auto-merge"
blockingLabels: "do not merge"
requiredChecks: "release,build-api (16.x)"