Summary
Adopt Morrison-Lab/gha's cleanup-pr-previews.yml@v2, a scheduled sweep that deletes gh-pages preview directories for PRs that are no longer open. This repo has no such housekeeping today.
Split out of #102 (the full preview-family migration) because this one has no blockers. #102 is held on two upstream gaps (Morrison-Lab/gha#608, #609); the cleanup cron depends on neither --- it reads gh-pages and the PR list and touches nothing the other three legs touch.
Evidence it is needed
The event-based removal in the current hand-rolled preview.yml does not reliably fire. Measured 2026-08-24:
$ gh api "repos/UCD-SERG/ucd-serg.github.io/contents/pr-preview?ref=gh-pages" --jq '.[].name'
pr-107 pr-108 pr-110 pr-111 pr-42 pr-65 pr-76
pr-42: CLOSED closed=2026-01-10T05:14:52Z
pr-65: MERGED closed=2026-05-12T06:18:17Z
Both are more than three months stale. Neither is a fork (isCrossRepository=false), and both had closed wired into preview.yml's types: list at the time, so the removal path existed and did not run.
I did not establish the cause. One plausible explanation is that the current workflow renders the whole site before removing, so a render failure blocks the removal --- but that is a hypothesis, not a verified finding, and it should not be treated as one when picking this up.
What to do
- Copy
gh api "repos/Morrison-Lab/gha/contents/examples/cleanup-pr-previews.yml?ref=v2" into .github/workflows/cleanup-pr-previews.yml.
- Grant
contents: write and pull-requests: read on the calling job, per gha's permissions table.
- Leave
preview-dir at its pr-preview default --- that matches what rossjrw/pr-preview-action writes here today.
- Decide on
compact-history. It orphan-squashes gh-pages to one commit after pruning, so deleted snapshots stop bloating the repo. It is destructive to gh-pages history, so it wants an explicit decision rather than a default; branch-based Pages only, which this repo is.
- Note the trigger is
schedule + workflow_dispatch, and schedule only fires from the default-branch copy --- so it does nothing until merged. Use workflow_dispatch to test it once it lands.
Scope
Independent of #102 and #103. Safe to land before either.
Summary
Adopt
Morrison-Lab/gha'scleanup-pr-previews.yml@v2, a scheduled sweep that deletesgh-pagespreview directories for PRs that are no longer open. This repo has no such housekeeping today.Split out of #102 (the full preview-family migration) because this one has no blockers. #102 is held on two upstream gaps (Morrison-Lab/gha#608, #609); the cleanup cron depends on neither --- it reads
gh-pagesand the PR list and touches nothing the other three legs touch.Evidence it is needed
The event-based removal in the current hand-rolled
preview.ymldoes not reliably fire. Measured 2026-08-24:Both are more than three months stale. Neither is a fork (
isCrossRepository=false), and both hadclosedwired intopreview.yml'stypes:list at the time, so the removal path existed and did not run.I did not establish the cause. One plausible explanation is that the current workflow renders the whole site before removing, so a render failure blocks the removal --- but that is a hypothesis, not a verified finding, and it should not be treated as one when picking this up.
What to do
gh api "repos/Morrison-Lab/gha/contents/examples/cleanup-pr-previews.yml?ref=v2"into.github/workflows/cleanup-pr-previews.yml.contents: writeandpull-requests: readon the calling job, per gha's permissions table.preview-dirat itspr-previewdefault --- that matches whatrossjrw/pr-preview-actionwrites here today.compact-history. It orphan-squashesgh-pagesto one commit after pruning, so deleted snapshots stop bloating the repo. It is destructive togh-pageshistory, so it wants an explicit decision rather than a default; branch-based Pages only, which this repo is.schedule+workflow_dispatch, andscheduleonly fires from the default-branch copy --- so it does nothing until merged. Useworkflow_dispatchto test it once it lands.Scope
Independent of #102 and #103. Safe to land before either.