-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (66 loc) · 1.84 KB
/
data-process.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: "Data Process"
on:
push:
branches:
- master
schedule:
- cron: "0 * * * *"
- cron: "5 4 * * 3"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
jobs:
script:
name: Script
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout data
uses: actions/checkout@v4
with:
ref: data
path: data
filter: blob:none
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Cache node modules
uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: npm ci
- name: Create local changes
timeout-minutes: 15
run: npm run script
env:
NODE_ENV: production
- run: |
cd data
git pull --rebase --autostash
- name: Commit files
id: auto-commit-action
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 更新資料
repository: data
- name: CharAssets Workflow Dispatch
if: steps.auto-commit-action.outputs.changes_detected == 'true'
uses: benc-uk/workflow-dispatch@v1
with:
workflow: CharAssets
token: ${{ secrets.PAT }}
- name: Check Banner Workflow Dispatch
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Check Banner
token: ${{ secrets.PAT }}