Skip to content

生成 README

生成 README #372

Workflow file for this run

name: 生成 README
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
# UTC + 8 = 中国时区
# 22:30 + 8 = 6:30(明天) 每 6 点半触发一次
- cron: '30 22 * * *'
# - cron: '* * * * *'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 设置时区
uses: szenius/set-timezone@v1.0
with:
timezoneLinux: 'Asia/Shanghai'
timezoneMacos: 'Asia/Shanghai'
timezoneWindows: 'Asia/Shanghai'
- name: Checkout
uses: actions/checkout@v3
- name: 环境配置
uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'npm'
- name: 缓存
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-js-${{ hashFiles('package-lock.json') }}
- name: 安装依赖
run: npm install
- name: 生成 README.md
run: npm run build --if-present
# - name: 推送新 README.md
# uses: mikeal/publish-to-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.WestCraneLi }}
- name: Commit and push if changed
run: |
git diff
git config --global user.email "WestCraneLi@foxmail.com"
git config --global user.name "WestCraneLi"
git remote set-url origin https://${{ github.actor }}:${{ secrets.WestCraneLi }}@github.com/${{ github.repository }}
git add -A
git commit --allow-empty -m "update daily sentence"
git pull --rebase
git push