64 lines
No EOL
1.9 KiB
YAML
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 |