-
Notifications
You must be signed in to change notification settings - Fork 65
44 lines (38 loc) · 1.22 KB
/
check-db.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
name: Check DB
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, closed]
jobs:
check-db:
runs-on: ubuntu-latest
if: >
github.event_name == 'pull_request' &&
github.event.pull_request.merged == false
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Dependencies
run: npm install
- name: Start Service
run: npm run dev &
- name: Update api.json
run: npm run api:download
- name: Check Diff
id: check_diff
run: |
echo "IS_DIFF=$(if git status | grep -q "packages/scripts/api.json"; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT
- name: Comment
if: steps.check_diff.outputs.IS_DIFF=='true'
uses: actions-cool/maintain-one-comment@v2.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
`TDesign.db`和`api.json`数据不一致,请执行`npm run api:download`。
- name: Error
if: steps.check_diff.outputs.IS_DIFF=='true'
run: |
git diff packages/scripts/api.json
exit 1