Skip to content

Fetch DMHY RSS

Fetch DMHY RSS #2429

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Fetch DMHY RSS
on:
schedule:
- cron: "0 */2 * * *"
workflow_dispatch:
inputs:
force_deploy:
description: 'force deploy pages'
type: boolean
default: false
required: true
permissions:
contents: write
jobs:
fetch:
runs-on: ubuntu-latest
outputs:
git_updated: ${{ steps.check_updates.outputs.no_updates == 'false' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "25.3"
- name: Generate Protobuf
run: ./generate_proto.sh
- name: Fetch RSS
run: |
python src/fetch_share_dmhy_org.py -c .env.prod
python src/cleanup_dmhy_rss_config.py -c .env.prod
- name: Check updates
id: check_updates
run: |
if [[ -z $(git status --porcelain) ]]; then
echo "no updates"
echo "no_updates=true" >> $GITHUB_OUTPUT
exit
else
echo "changes detected"
echo "no_updates=false" >> $GITHUB_OUTPUT
fi
- name: Commit files
if: steps.check_updates.outputs.no_updates == 'false'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add storage
git commit -a -m "manually fetch rss"
- name: Push changes
if: steps.check_updates.outputs.no_updates == 'false'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
deploy:
uses: ./.github/workflows/build-cicd.yml
with:
source_branch: ${{ github.ref }}
needs: [fetch]
if: ${{ needs.fetch.outputs.git_updated || inputs.force_deploy }}
permissions:
contents: read
pages: write
id-token: write