mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-13 12:22:33 -05:00
refactor: consolidate CI pipeline, remove third-party deps
This commit is contained in:
126
.github/workflows/watch.yml
vendored
Normal file
126
.github/workflows/watch.yml
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
name: Weekly Platform Sync
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 6 * * 1" # Every Monday at 06:00 UTC
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: watch-updates
|
||||
cancel-in-progress: true
|
||||
|
||||
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 bios/ platforms/ database.json README.md CONTRIBUTING.md
|
||||
git commit -m "chore: auto-update platform data ($DATE)"
|
||||
git push origin "$BRANCH" --force-with-lease
|
||||
|
||||
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 }}
|
||||
Reference in New Issue
Block a user