-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (26 loc) · 914 Bytes
/
keepalive.yml
File metadata and controls
31 lines (26 loc) · 914 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
name: Keep Repo Active
on:
schedule:
# 每天 UTC 00:00(北京时间 08:00)运行
- cron: '0 0 * * *'
workflow_dispatch: # 允许手动触发
permissions: # 赋予写入权限
contents: write
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update README with precise time
run: |
# 获取当前时间(精确到秒,格式:YYYY-MM-DD HH:MM:SS)
CURRENT_TIME=$(date +'%Y-%m-%d %H:%M:%S')
# 修改 README.md 的最后一行
sed -i "\$s/.*/Last updated: $CURRENT_TIME/" README.md
# 提交更改
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add README.md
git commit -m "Update README with precise time"
git push