Archive podcast feeds #19530
This file contains 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: 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/command-output@v2.0.0 | |
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 |