Problem
Wiki preview branches such as pr-<number> are useful while a pull request is open, but they can remain in the wiki repository after the pull request is closed or merged. Over time, stale preview branches make the wiki repository harder to inspect and can confuse maintainers about which preview branches are still active.
Proposal
Update the wiki automation so PR-scoped wiki branches are removed when they are no longer needed, and add a periodic cleanup path that removes branches for pull requests that are already closed.
Goals
- Delete the PR wiki branch after the pull request is closed and the accepted content has been promoted when appropriate.
- Periodically scan wiki preview branches and remove branches whose matching pull request is already closed.
- Keep the wiki
master branch as the only canonical published branch after merge.
- Make cleanup safe for branches that do not follow the
pr-<number> naming convention.
Expected Behavior
When a pull request is merged, the workflow promotes the PR wiki branch content to the wiki master branch and then deletes the corresponding pr-<number> wiki branch. When a pull request is closed without merge, the corresponding preview branch is deleted without promoting it to master. A scheduled cleanup also removes leftover pr-<number> branches for already closed pull requests.
Implementation Strategy
Extend the wiki workflow logic to delete the PR preview branch after the close/merge flow completes. Add a scheduled cleanup job or workflow path that lists pr-<number> branches in the wiki repository, checks the related pull request state through GitHub APIs, and deletes branches only when the pull request is closed.
Requirements
- The merge-to-
master path must complete before deleting the preview branch for merged pull requests.
- Closed, unmerged pull requests must have their wiki preview branch deleted without publishing to
master.
- Periodic cleanup must ignore branches that do not match
pr-<number>.
- Missing preview branches must not fail the workflow.
- Workflow permissions must be limited to the operations needed to read pull requests and update wiki refs.
- Documentation or troubleshooting notes must be updated if the cleanup changes the maintainer workflow.
Non-goals
- Changing how wiki previews are generated for open pull requests.
- Renaming the wiki
master branch.
- Deleting manually maintained wiki branches that are not PR preview branches.
Benefits
This keeps the wiki repository tidy, reduces stale preview state, and makes the PR preview lifecycle match the reports preview cleanup model.
Acceptance Criteria
Functional Criteria
Architectural / Isolation Criteria
Problem
Wiki preview branches such as
pr-<number>are useful while a pull request is open, but they can remain in the wiki repository after the pull request is closed or merged. Over time, stale preview branches make the wiki repository harder to inspect and can confuse maintainers about which preview branches are still active.Proposal
Update the wiki automation so PR-scoped wiki branches are removed when they are no longer needed, and add a periodic cleanup path that removes branches for pull requests that are already closed.
Goals
masterbranch as the only canonical published branch after merge.pr-<number>naming convention.Expected Behavior
When a pull request is merged, the workflow promotes the PR wiki branch content to the wiki
masterbranch and then deletes the correspondingpr-<number>wiki branch. When a pull request is closed without merge, the corresponding preview branch is deleted without promoting it tomaster. A scheduled cleanup also removes leftoverpr-<number>branches for already closed pull requests.Implementation Strategy
Extend the wiki workflow logic to delete the PR preview branch after the close/merge flow completes. Add a scheduled cleanup job or workflow path that lists
pr-<number>branches in the wiki repository, checks the related pull request state through GitHub APIs, and deletes branches only when the pull request is closed.Requirements
masterpath must complete before deleting the preview branch for merged pull requests.master.pr-<number>.Non-goals
masterbranch.Benefits
This keeps the wiki repository tidy, reduces stale preview state, and makes the PR preview lifecycle match the reports preview cleanup model.
Acceptance Criteria
Functional Criteria
masterand deletes the matchingpr-<number>branch afterward.pr-<number>branch without publishing it tomaster.pr-<number>wiki branches whose pull requests are already closed.Architectural / Isolation Criteria