Update Date in README #69
This file contains hidden or 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: 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 'ugyunn' | |
git config --global user.email 'tyfgyubhn@njknm.jkklk' | |
git add README.md | |
git commit -m "Update date in README.md to $current_date" | |
git push |