Auto Update News #990
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: Auto Update News | |
on: | |
schedule: | |
- cron: "0 2-10 * * *" # 北京时间每天早上10点到下午20点每隔一小时运行一次 | |
workflow_dispatch: | |
jobs: | |
update-news: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "14" | |
- name: Install dependencies | |
run: npm install | |
- name: Run Node.js script to check and update news | |
run: node app.js | |
env: | |
PUSHPLUS_TOKEN: ${{ secrets.PUSHPLUS_TOKEN }} | |
PUSHPLUS_TOPIC: ${{ secrets.PUSHPLUS_TOPIC }} | |
SERVERCHAN_SCKEY: ${{ secrets.SERVERCHAN_SCKEY }} | |
WECHAT_BOT_URL: ${{ secrets.WECHAT_BOT_URL }} | |
- 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 news.md | |
git commit -m "docs: update the archive" || echo "docs: no updates" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |