-
Notifications
You must be signed in to change notification settings - Fork 937
61 lines (52 loc) · 1.72 KB
/
schema-generate-config.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
name: Generate config JSON schema
on:
push:
branches:
- main
paths:
- 'backend/config/*.go'
- '!backend/config/config_default.go'
- '!backend/config/**test.go'
jobs:
config:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Checkout backend
uses: actions/checkout@v4
with:
path: hanko
- name: Generate config JSON schema
working-directory: ./hanko/backend
run: |
go generate ./...
go run main.go schema generate config
- name: Create pull request
working-directory: ./hanko
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
if ! git diff-index --quiet HEAD; then
git checkout -b "chore-autogenerate-config-json-schema-${{ github.run_id }}"
git commit -m "chore: autogenerate config JSON schema"
git push origin HEAD
gh pr create \
-B main \
-H "chore-autogenerate-config-json-schema-${{ github.run_id }}" \
-t "chore: autogenerate config JSON schema" \
-b '# Description
Autogenerate config JSON schema. Created by Github Action.
# Additional context
Ref: `${{ github.ref }}`
Workflow name: `${{ github.workflow }}`
Job ID: `${{ github.job }}`
Run ID: `${{ github.run_id }}`'
else
echo "No changes detected, skipping pull request creation."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}