Update Bing Wallpaper README #89
This file contains 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 Bing Wallpaper README | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
# 检出代码仓库 | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false # 禁用默认的凭据,确保使用 GITHUB_TOKEN | |
# 设置 Python 环境 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
# 安装依赖 | |
- name: Install Dependencies | |
run: pip install requests | |
# 运行 Python 脚本以更新 README 和生成提交信息 | |
- name: Generate README and Commit Message | |
id: generate_commit_message | |
run: | | |
python .github/ci/update_readme.py > commit_message.txt | |
# 提交修改到仓库 | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add README.md | |
# 使用生成的提交信息 | |
git commit -F commit_message.txt || echo "No changes to commit" | |
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:${{ github.ref }} |