Skip to content

RSS Feed Update

RSS Feed Update #1357

name: RSS Feed Update
on:
schedule:
- cron: '0 */6 * * *' # Runs every 6 hours
workflow_dispatch: # Allows manual triggering
# Explicitly set permissions for the workflow
permissions:
contents: write
actions: write
jobs:
update-feed:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests pillow beautifulsoup4 lxml
- name: Run RSS feed download script
run: python scripts/download_rss.py
- name: Commit and push if changes exist
id: commit-push
run: |
git config --global user.name 'Michael Lamb'
git config --global user.email 'michaellambgelo@users.noreply.github.com'
git add .
git diff --quiet && git diff --staged --quiet || (
git commit -m "Auto update RSS feed data"
git push
echo "changes_pushed=true" >> $GITHUB_OUTPUT
)
- name: Trigger deploy workflow
if: steps.commit-push.outputs.changes_pushed == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'deploy.yml',
ref: 'main'
})