Data Process #35974
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |