deb-mock/.forgejo/workflows/update-readme.yml
robojerk 0ba814ddad
Some checks failed
Build Deb-Mock Package / build (push) Failing after 57s
Test Deb-Mock Build / test (push) Failing after 53s
fix git clone URLs to use external Forgejo URL instead of internal Docker network
2025-08-03 22:36:54 +00:00

64 lines
No EOL
1.9 KiB
YAML

name: Update README
on:
workflow_run:
workflows: ["Build Deb-Mock Package", "Test Deb-Mock Build"]
types:
- completed
jobs:
update-readme:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout code
run: |
git clone https://git.raines.xyz/robojerk/deb-mock.git /tmp/deb-mock
cp -r /tmp/deb-mock/* .
cp -r /tmp/deb-mock/.* . 2>/dev/null || true
- name: Set up Python
run: |
sudo apt update
sudo apt install -y python3.12 python3.12-venv python3-pip
- name: Install dependencies
run: |
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- name: Update README with build status
run: |
source venv/bin/activate
python -c "
import re
from datetime import datetime
# Read current README
with open('README.md', 'r') as f:
content = f.read()
# Update last updated timestamp
timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC')
# Update last updated
if 'Last updated:' in content:
content = re.sub(r'Last updated:.*', f'Last updated: {timestamp}', content)
else:
# Add after the title
content = content.replace('# Deb-Mock', f'# Deb-Mock\n\n**Last updated: {timestamp}**')
# Write updated README
with open('README.md', 'w') as f:
f.write(content)
"
- name: Commit and push changes
run: |
git config --local user.email "action@forgejo.com"
git config --local user.name "Forgejo Action"
git add README.md
git diff --quiet && git diff --staged --quiet || git commit -m "Update README with build status"
git push