Skip to content

Update Feed

Update Feed #227

Workflow file for this run

name: Update Feed
# on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
on:
schedule:
- cron: '0 1 * * *' # daily update
workflow_dispatch:
jobs:
update_feed:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
# cache: 'pip' # needs a requirements.txt
- name: Run update script
run: python ./src/update_feed.py
- name: commit updates (if available)
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
today=$(date +%F)
branch="update-$today"
git checkout -b $branch
git add .
if [ -z "$(git status --porcelain)" ]; then
echo "No updates available"
exit 0
fi
git commit -m "new update"
git push -u origin $branch
gh pr create --title "Update $today" --base main --head $branch --body 'Created by Github action'
gh pr merge --auto --squash