-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (43 loc) · 1.58 KB
/
schedule.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
name: Schedule Update
on:
schedule:
- cron: "0 0 * * 0" # 每週日晚上 12:00 UTC
workflow_dispatch: # 支援手動觸發
jobs:
update:
name: Update Resources
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
ref: develop
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "22"
- name: Install dependencies
run: npm install
- name: Run download script
run: npm run download
- name: Commit changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git reset package-lock.json
if git diff-index --quiet HEAD --; then
echo "No changes to commit"
else
git commit -m 'Scheduled resource update'
git push origin develop
fi
- name: Merge develop into master
if: ${{ !github.event.inputs || github.event.inputs.force || github.ref == 'refs/heads/develop' }}
run: |
git fetch origin
git checkout master
git merge origin/develop
git push origin master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}