-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (35 loc) · 1.21 KB
/
update-recent-articles.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
41
42
43
name: Update Recent Articles
on:
schedule:
- cron: '0 16 * * *' # 北京时间 00:00
- cron: '0 4 * * *' # 北京时间 12:00
jobs:
update-recent-articles:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --production
- name: Run update-recent-articles script
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_GITHUB_TOKEN }}
GITHUB_USER: toFrankie
GITHUB_REPO: blog
run: bun run scripts/update-recent-articles.ts
- name: Check if recent-articles.md has changed
id: check_changes
run: |
git diff --exit-code docs/recent-articles.md || echo "file_changed=true" >> $GITHUB_ENV
- name: Commit changes
if: env.file_changed == 'true'
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add docs/recent-articles.md
git commit -m "docs: update recent articles"
git push origin main