-
Notifications
You must be signed in to change notification settings - Fork 3
71 lines (59 loc) · 2.21 KB
/
archive-podcast-feeds.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Archive podcast feeds
on:
schedule:
#- cron: '26 0,3,6,9,12,15,18,21 * * *'
- cron: '26 15 * * *'
workflow_dispatch:
jobs:
archive-feeds:
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Checkout
uses: actions/checkout@v3
- name: Fetch podcast feeds
run: python feed-archive/step-1-fetch-feeds.py
- name: Parse podcast feeds
run: python feed-archive/step-2-parse-feeds.py
- name: Diff podcast feeds
run: python feed-archive/step-3-diff-feeds.py
- name: Print podcast episode duration changes
uses: mathiasvr/[email protected]
id: diff-times
with:
run: python feed-archive/step-4-diff-times.py
- name: Discard new feed snapshots if there are no parsed changes
run: |
count=$(wc -w \
$(ls feed-archive/critical-role/parsed/diffs/*.diff | tail -n1) \
$(ls feed-archive/geek-and-sundry/parsed/diffs/*.diff | tail -n1) \
| grep total \
| tr -d [:alpha:],[:space:])
echo "New diffs contain ${count} words"
if [ ${count} = 0 ]; then
echo "Discarding changes"
rm -rf feed-archive
git reset --hard
else
echo "Keeping changes"
fi
- name: Create pull request
id: pr
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update podcast feed archive
title: Update podcast feed archive
body: This automated pull request was generated by the "[${{ github.workflow }}](https://github.com/critrolesync/critrolesync.github.io/actions/workflows/archive-podcast-feeds.yml)" GitHub Actions workflow.
${{ steps.diff-times.outputs.stdout }}
branch: update-feed-archive
labels: feed archive update
delete-branch: true
- name: Print pull request information
run: |
echo "Pull request number: ${{ steps.pr.outputs.pull-request-number }}"
echo "Pull request URL: ${{ steps.pr.outputs.pull-request-url }}"
- name: Show podcast feed changes
run: git diff --output-indicator-new=" " master update-feed-archive -- *.diff