-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (43 loc) · 1.23 KB
/
update_feed.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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