Create update-date.yml

This commit is contained in:
wd210010 authored and GitHub committed 2025-02-19 10:35:00 +08:00
1 parent d191770960
commit b72327ae98
1 file changed
+40
+40
View File
@@ -0,0 +1,40 @@
name: Update Date
on:
schedule:
- cron: '0 0 * * *' # 每天午夜 (UTC) 运行一次
push:
branches:
- main # 也可以在推送到主分支时触发
jobs:
update-date:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run the update script
run: |
python update_date.py
- name: Commit and push changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add date_config.json
git commit -m "Update date to $(date +'%Y-%m-%d')"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}