Files

103 lines
4.1 KiB
YAML

name: Mirror game-status issues
# Game-status issues live on the KytyPS5 repo (Game Emulation Status Report
# template, kytyps5-game-emulation.yaml). GitHub Actions can't react to another
# repo's events, so this workflow POLLS the KytyPS5 issues API and mirrors each
# unconverted "[GAME STATUS]" issue as an issue HERE (label `compat`) — one
# mirror per (game, OS). Converting happens on demand: a maintainer comments
# `/compat` on a mirror and compat-convert.yml turns it into ONE report PR for
# that game, so games stay separate instead of piling into a single standing
# report PR.
#
# Skips are tracked without extra state:
# - a closed mirror means the issue was already converted via /compat (the
# per-game PR is updated in place on re-runs), and
# - a report already exists for the same (game, OS) whose testedDate is as
# new or newer than the upstream issue's creation date (dates, not issue
# numbers: a report records ONE source, and converting a newer issue for
# the same game would overwrite the older one's marker).
# Scheduled runs also refresh OPEN mirrors whose upstream body changed — fixing
# an upstream issue (e.g. filling in the PPSA-XXXXX) is picked up by the next
# poll, no manual cleanup.
#
# Manual runs: Actions → "Mirror game-status issues" → Run workflow → type a
# KytyPS5 issue number. The mirror is created (or reopened + refreshed if it
# exists), then run /compat on it to convert — use this after you verified an
# issue and the report should reflect its current status. When the mirror's
# fields need a human fix first (OS that doesn't generalize, missing
# PPSA-XXXXX, wrong title, status), comment /setos /setid /settitle /setstatus on it — the
# overrides survive refreshes and the /compat conversion applies them.
on:
schedule:
- cron: "*/30 * * * *" # every 30 minutes (may be delayed under load)
workflow_dispatch:
inputs:
issue_number:
description: Mirror (or reopen + refresh) a specific KytyPS5 issue
required: false
type: string
# Only issues are touched — no code, no PRs (dispatches compat-convert.yml for trusted updates).
permissions:
contents: read
issues: write
actions: write
concurrency:
group: compat-issues
cancel-in-progress: true
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Ensure the compat, updated-existing and trusted labels exist
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh label create compat \
--description "Mirror of a KytyPS5 issue — edit fields with commands, then /compat" \
--force
gh label create updated-existing \
--description "Upstream report was edited with changed status or version" \
--color "D4C5F9" \
--force
gh label create trusted \
--description "Report marked trusted by collaborator — auto-accepts updates" \
--color "2ea44f" \
--force
- name: Mirror unconverted issues
id: sync
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_ISSUE_NUMBER: ${{ inputs.issue_number }}
run: |
ARGS=()
if [ -n "$INPUT_ISSUE_NUMBER" ]; then
ARGS+=(--issue-number "$INPUT_ISSUE_NUMBER")
fi
node scripts/sync-status-issues.mjs "${ARGS[@]}"
- name: Auto-convert trusted updates
if: steps.sync.outputs.trusted_updates != '' && steps.sync.outputs.trusted_updates != '[]'
env:
GH_TOKEN: ${{ secrets.ACTIONS_BOT_TOKEN || secrets.GITHUB_TOKEN }}
UPDATES: ${{ steps.sync.outputs.trusted_updates }}
run: |
if [ -z "$UPDATES" ] || [ "$UPDATES" = "[]" ]; then
echo "No trusted updates to convert."
exit 0
fi
for num in $(echo "$UPDATES" | jq -r '.[]'); do
echo "Auto-converting trusted update for mirror issue #$num..."
gh workflow run compat-convert.yml -f issue_number="$num"
done