-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (33 loc) · 1.14 KB
/
run.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
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 }}