mirror of
https://github.com/wd210010/only_for_happly.git
synced 2026-11-05 20:26:45 +08:00
Create update-date.yml
This commit is contained in:
1 parent
d191770960
commit
b72327ae98
1 file changed
+40
@@ -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 }}
|
||||
Reference in new issue
Block a user