Parse RSS #1523
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: Parse RSS | |
on: | |
schedule: | |
- cron: '0 */12 * * *' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
parse_rss: | |
runs-on: ubuntu-latest | |
env: | |
HAS_COMMITS: false | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.BOT_ID }} | |
private-key: ${{ secrets.BOT_SK }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: rss | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' # caching pip dependencies | |
- name: Parse latest episodes from RSS | |
run: | |
cd .github/scripts && | |
pip install -r requirements.txt && | |
python3 rss_parser.py | |
- name: Commit files | |
id: commit_files | |
if: always() | |
run: | | |
git config --local user.email "github-actions@github.com" | |
git config --local user.name "github-actions" | |
if [[ -n $(git status --porcelain) ]]; then | |
git add -A | |
git commit -m "[no-tweet] refreshed episodes 🤖" | |
echo "HAS_COMMITS=true" >> $GITHUB_ENV | |
else | |
echo "no changes - skipping commit" | |
echo "HAS_COMMITS=false" >> $GITHUB_ENV | |
fi | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
if: env.HAS_COMMITS == 'true' | |
with: | |
github_token: ${{ steps.app-token.outputs.token }} | |
branch: rss |