-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (52 loc) · 1.72 KB
/
pocketbase-typegen.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
name: Generate pocketbase types
on:
push:
branches:
- main
jobs:
typegen:
name: Generate pocketbase types
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm ci
- name: Generate types
env:
PUBLIC_PB_HOST: ${{ vars.PB_HOST }}
PB_ADMIN_PASSWORD: ${{ secrets.PB_ADMIN_PASSWORD }}
PB_ADMIN_EMAIL: ${{ secrets.PB_ADMIN_EMAIL }}
run: make pb_types
- name: Upload generated types
uses: actions/upload-artifact@v4
with:
name: generated-types
path: src/lib/pocketbase/index.d.ts
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Set branch name
run: |
echo "branch=typegen-$(date +%s)" >> $GITHUB_ENV
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ $(git status --porcelain | wc -l ) -gt 0 ]; then
# If there is a diff: https://stackoverflow.com/a/62213712
git checkout -b "$branch"
git add --force src/lib/pocketbase/index.d.ts
git commit -m "chore: update pocketbase types"
git push origin "$branch"
gh pr create --base "main" \
--head "$branch" \
--title "Update pocketbase types" \
--body "Updated at $(date -Iminutes)" \
--label "typegen"
fi