-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (33 loc) · 1.16 KB
/
check-diff.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
name: Check diff (daily)
on:
schedule:
- cron: '0 23 * * 0-4'
workflow_dispatch:
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pnpm-setup-node
- run: pnpm install --frozen-lockfile --ignore-script
- name: Run command and check for changes
run: |
pnpm generate-type
git diff > diff.patch
if [ -s diff.patch ]; then
pnpm rimraf ./diff.patch
git config --global user.name "fe-dudu"
git config --global user.email "[email protected]"
timestamp=$(date +'%Y%m%d%H%M%S')
branch_name="diff-${timestamp}"
git checkout -b $branch_name
git add .
git commit -m "There have been changes to the API type"
git push origin $branch_name
gh pr create --title "API type change" --body "This is a PR created by GitHub Actions." --base main --head $branch_name
else
pnpm rimraf ./diff.patch
exit 0
fi
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}