Generate Markdown on Schedule #11660
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: Generate Markdown on Schedule | |
on: | |
schedule: | |
- cron: '*/15 * * * *' # 每五分钟运行一次 | |
workflow_dispatch: # 手动触发 | |
jobs: | |
update-json: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: true | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Generate Markdown file | |
run: | | |
python scripts/generate_markdown.py | |
- name: Commit Markdown file | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git add output.md | |
if git diff-index --quiet HEAD; then | |
echo "No changes to commit" | |
else | |
git commit -m "Update output.md on schedule" | |
git push | |
fi |