Description
Summary
Closing a pull request while its Lua documentation is publishing can leave a preview online after cleanup. Reopening a PR can produce the opposite result. A delayed cleanup for the earlier close can delete the newly published preview.
Reproduction
On d8266f22, compare the GitHub Actions groups used to publish a preview and to delete it.
$ rg -n 'group:|Delete this Lua preview' .github/workflows/{docs,docs-preview-cleanup}.ymlLet the upload pass its open-PR check, close the PR, and then let the upload finish. For the reopen case, let the reopened PR publish fresh files before the older close job runs. The local regression ran the shared publisher’s actual sync step and Lua’s scripts/docs/docs.lua delete-preview against one temporary directory. Fixture responses supplied the PR state.
Expected
After the jobs finish, the closed PR has no preview. The reopened PR keeps the preview for its current source.
Actual
The publisher takes docs-deploy-${{ github.repository }}. Cleanup takes docs-preview-lua-pr-${{ github.event.pull_request.number }} and deletes the PR’s preview without rereading its state. In the first replay, the preview files were present after the close finished. In the second, the earlier close removed both fresh files.
Using the same queue for both workflows and checking the PR state when cleanup starts passed both cases locally. Draft #214 owns the Lua workflow migration. The separate website issue tracks how long previews wait. Migration PR · Preview wait times.
On December 5–6 the next seven PR closes also exposed a failure before any deletion could start. GitHub blocked the pull_request_target cleanup workflow under its default public-repository policy. For #169, GitHub recorded a startup failure, zero jobs and zero check runs. The deletion command never ran. Whether an older preview existed at that URL is unknown. The last preceding successful cleanup was November 29. #169 run annotation · November cleanup.
A local alternative checks the Lua previews that still exist once an hour from the default branch. It removes a preview only after GitHub says its PR is closed. If listing the folders fails or GitHub cannot confirm the PR state, the files stay in place. The tests kept open and reopened previews, removed a closed preview once, and retried a failed deletion on the next sweep. All 17 Lua tests and 11 command-line cases passed with local stand-ins for GitHub and S3.
The published draft still uses the blocked close event. The proposed hourly check also needs evidence that the Lua cleanup role can list the preview folders. Then verify a real close and reopen, inspect the files at the origin and visit the public preview URL. Current cleanup workflow · Migration PR.
References
Both queue names date to September 20. Original workflow commit · Publication queue · Cleanup queue and deletion.
Activity