Files
libretro/.github/workflows/watch-updates.yml
Abdessamad Derraz 13c561888d v2: automated BIOS platform with full pipeline
Reorganized 6 branches into bios/Manufacturer/Console/.
Scrapers for RetroArch, Batocera, Recalbox, and libretro core-info.
Platform-aware verification replicating native logic per platform.
Pack generation with dedup, alias resolution, variant support.
CI/CD: weekly auto-scrape, auto-release, PR validation.
Large files (>50MB) stored as GitHub Release assets, auto-fetched at build time.
2026-03-17 10:54:39 +01:00

124 lines
4.4 KiB
YAML

name: Watch Platform Updates
on:
schedule:
- cron: "0 6 * * 1" # Every Monday at 06:00 UTC
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: write
jobs:
scrape-and-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: pip install pyyaml
- name: Regenerate platform configs from live sources
run: |
python3 -c "
import sys, yaml
sys.path.insert(0, 'scripts')
def str_representer(dumper, data):
if any(c in data for c in '()[]{}:#'):
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='\"')
return dumper.represent_scalar('tag:yaml.org,2002:str', data)
yaml.add_representer(str, str_representer)
# Regenerate retroarch.yml from live System.dat + core-info
from scraper.libretro_scraper import Scraper as LS
config = LS().generate_platform_yaml()
with open('platforms/retroarch.yml', 'w') as f:
yaml.dump(config, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
print(f'RetroArch: {len(config[\"systems\"])} systems, version={config[\"version\"]}')
# Regenerate batocera.yml from live batocera-systems
from scraper.batocera_scraper import Scraper as BS
config = BS().generate_platform_yaml()
with open('platforms/batocera.yml', 'w') as f:
yaml.dump(config, f, default_flow_style=False, allow_unicode=True, sort_keys=False)
print(f'Batocera: {len(config[\"systems\"])} systems, version={config[\"version\"]}')
"
- name: Auto-fetch missing BIOS files
run: |
python scripts/generate_db.py --bios-dir bios --output database.json
python scripts/auto_fetch.py --all 2>&1 | tee /tmp/fetch_report.txt || true
- name: Deduplicate BIOS files
run: python scripts/dedup.py
- name: Regenerate database and documentation
run: |
python scripts/generate_db.py --force --bios-dir bios --output database.json
python scripts/generate_readme.py --db database.json --platforms-dir platforms
- name: Check for changes
id: check
run: |
if git diff --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then
echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
echo "has_changes=true" >> "$GITHUB_OUTPUT"
echo "Changes detected:"
git diff --stat
git ls-files --others --exclude-standard | head -20
fi
- name: Create or update PR
if: steps.check.outputs.has_changes == 'true'
run: |
DATE=$(date +%Y-%m-%d)
BRANCH="auto/update-platforms-${DATE}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
git add -A
git commit -m "chore: auto-update platform data ($DATE)"
git push origin "$BRANCH" --force
existing_pr=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
if [ -n "$existing_pr" ] && [ "$existing_pr" != "null" ]; then
echo "Updating existing PR #${existing_pr}"
else
gh pr create \
--title "Auto-update: Platform data ($DATE)" \
--body "$(cat <<'EOF'
## Automated Platform Update
This PR was automatically generated by the weekly platform watch.
### What changed
- Scraped latest BIOS requirements from libretro System.dat and batocera-systems
- Auto-fetched new BIOS files from public sources
- Deduplicated and regenerated database + documentation
### Review Checklist
- [ ] New BIOS files are valid
- [ ] Platform configs are correct
- [ ] database.json and README look good
---
*Auto-generated by [watch-updates](../../actions/workflows/watch-updates.yml)*
EOF
)" \
--label "automated,platform-update"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}