Testing the generating the RSS feeds as a job #17
This file contains hidden or 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 RSS Feed for docs | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'docs/**/*.pdf' # Only trigger on PDF changes in docs/ | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
# Step 2: Wait for a short time to ensure the PDF has been fully committed | |
- name: Wait for file to be committed | |
run: | | |
echo "Waiting for the PDF to be fully committed..." | |
sleep 10 # Wait for 10 seconds to ensure the push has been reflected in the repo | |
# Step 3: Generate the RSS feed with the updated PDF | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Generate RSS feed from PDFs | |
run: | | |
python generate_rss.py | |
# Step 4: Commit and push the updated RSS feed | |
- name: Commit and push updated rss.xml | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add docs/rss.xml | |
git commit -m "Update RSS feed with new (modified) article" || echo "No changes to commit" | |
git push |