39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
name: updateBydszb
|
|
on:
|
|
workflow_dispatch:
|
|
# push:
|
|
schedule:
|
|
- cron: 0 */4 * * *
|
|
jobs:
|
|
run:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: 检出
|
|
uses: actions/checkout@v4
|
|
- name: 创建NodeJs20
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
cache: 'npm'
|
|
cache-dependency-path: ./package-lock.json
|
|
- name: Cache node_modules in api directory
|
|
id: cache-npm
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ./node_modules
|
|
key: ${{ runner.os }}-node-${{ hashFiles('./api/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-
|
|
- name: 更新内容
|
|
run: node fetchURLByzbpro.js
|
|
- name: 推送
|
|
run: |
|
|
if ! git diff --quiet --exit-code || [ -n "$(git status --porcelain)" ]; then
|
|
git config user.name "GitHub Actions"
|
|
git config user.email "actions@github.com"
|
|
git add .
|
|
git commit -m "Update by GitHub Actions"
|
|
git push
|
|
fi
|