Update HuggingFace Trending Feed #15
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 HuggingFace Trending Feed | |
on: | |
schedule: | |
- cron: '0 0 * * *' # 每天运行一次 | |
workflow_dispatch: # 允许手动触发 | |
jobs: | |
update-feed: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Update feeds | |
run: python update_feed.py | |
- name: Commit and push if changed | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email '[email protected]' | |
git add docs/ | |
git diff --quiet && git diff --staged --quiet || (git commit -m "Update feeds" && git push origin main) | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |