-
Notifications
You must be signed in to change notification settings - Fork 3
36 lines (28 loc) · 905 Bytes
/
Copy pathmain.yml
File metadata and controls
36 lines (28 loc) · 905 Bytes
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
name: Update Date in README
# 触发条件
on:
workflow_dispatch:
# 定时触发
schedule:
# 每6小时获取一次
- cron: '0 */12 * * *'
jobs:
update-date:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Update date in README.md
run: |
# 获取当前日期,格式为 YYYY-MM-DD
current_date=$(date +'%Y-%m-%d')
sed -i "1s/更新时间 .*/更新时间 $current_date/" README.md
# 输出文件内容以便调试
cat README.md
- name: Commit and push changes
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@users.noreply.github.com'
git add README.md
git commit -m "Update date in README.md to $current_date"
git push