Files
huggingface-daily-paper-feed/.github/workflows/update_feed_monthly.yml
2025-04-25 18:15:59 +08:00

46 lines
1.5 KiB
YAML

name: Update Hugging Face Papers Monthly RSS Feed
on:
schedule:
# Runs on the 1st of every month at midnight UTC
- cron: '0 0 1 * *'
workflow_dispatch: # Allows manual triggering
jobs:
update-feed-monthly:
runs-on: ubuntu-latest
permissions:
contents: write # Allow the job to push changes
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11' # Specify Python version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Generate monthly URL
id: generate_url
run: |
MONTHLY_TAG=$(date +%Y-%m) # Format: YYYY-MM
echo "Generated monthly tag: $MONTHLY_TAG"
URL="https://huggingface.co/papers/month/${MONTHLY_TAG}"
echo "URL=$URL" >> $GITHUB_OUTPUT
- name: Run parser and generate monthly feed
run: python parser.py --source ${{ steps.generate_url.outputs.URL }} --output feed_monthly.xml
- name: Commit and push if monthly feed changed
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add feed_monthly.xml
# Commit only if there are changes staged
git diff --staged --quiet || git commit -m "Update Monthly RSS feed"
git push