71 lines
2.3 KiB
YAML
71 lines
2.3 KiB
YAML
name: Update Laws from RSS
|
|
|
|
on:
|
|
schedule:
|
|
# Täglich um 02:00 UTC (03:00 MEZ / 04:00 MESZ)
|
|
- cron: '0 2 * * *'
|
|
# Manueller Trigger für Tests
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update:
|
|
runs-on: docker
|
|
container:
|
|
image: node:20-bookworm
|
|
steps:
|
|
- name: Install system dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y python3 python3-pip git
|
|
git config --global user.name 'LawGit Bot'
|
|
git config --global user.email 'bot@git.coded.law'
|
|
git config --global init.defaultBranch main
|
|
git config --global http.postBuffer 524288000
|
|
|
|
- name: Checkout repository
|
|
run: |
|
|
git clone --depth=1 https://lawgit-bot:${{ gitea.token }}@git.coded.law/${{ gitea.repository }}.git .
|
|
git fetch --unshallow || true
|
|
|
|
- name: Install Python dependencies
|
|
run: |
|
|
pip install --break-system-packages -r requirements.txt
|
|
|
|
- name: Run update script
|
|
run: |
|
|
mkdir -p laws
|
|
python3 update_laws.py
|
|
continue-on-error: true
|
|
|
|
- name: Convert XML to Markdown
|
|
if: always()
|
|
run: |
|
|
mkdir -p laws
|
|
if [ -d "laws" ] && [ "$(ls -A laws 2>/dev/null)" ]; then
|
|
python3 xml_to_markdown.py --prod || echo "Konvertierung fehlgeschlagen oder keine Änderungen"
|
|
else
|
|
echo "Info: laws Verzeichnis ist leer, überspringe Konvertierung"
|
|
fi
|
|
continue-on-error: true
|
|
|
|
- name: Commit and push changes
|
|
run: |
|
|
git add -A
|
|
if git diff --staged --quiet; then
|
|
echo "Keine Änderungen gefunden"
|
|
else
|
|
echo "Änderungen gefunden:"
|
|
git status
|
|
git commit -m "Update laws from RSS - $(date +'%Y-%m-%d %H:%M:%S UTC')"
|
|
git remote set-url origin https://lawgit-bot:${{ gitea.token }}@git.coded.law/${{ gitea.repository }}.git
|
|
timeout 600 git push --progress origin main 2>&1 || echo "Push fehlgeschlagen oder Timeout"
|
|
fi
|
|
|
|
- name: Summary
|
|
if: always()
|
|
run: |
|
|
echo "## Update-Zusammenfassung"
|
|
echo "- Workflow ausgeführt: $(date)"
|
|
echo "- Python: $(python3 --version)"
|
|
echo "- Git: $(git --version)"
|