Skip to content

CI: clean up old Cloudflare Pages previews - #529

Merged
simonebortolin merged 2 commits into
mainfrom
ci/preview-cleanup
Nov 14, 2026
Merged

simonebortolin merged 2 commits into
mainfrom
ci/preview-cleanup

Conversation

@simonebortolin

Copy link
Copy Markdown
Contributor

Summary

  • New preview-cleanup workflow: deletes every deployment of the hack-gpon-preview Cloudflare Pages project except the newest of each open PR (and the project's canonical deployment, which can't be deleted). Runs when a PR is closed, after each preview-deploy, weekly, and manually (with a dry-run option).
  • One Cloudflare branch per PR: previews are published on pr-<number> instead of the shared preview branch, so deployments can be matched to their PR. The PR comment also shows the alias URL, which always points to the latest preview.
  • Built site kept for 30 days instead of 1: upload-pages-artifact defaults to 1 day, so a fork PR approved later than that failed with tar: github-pages/artifact.tar: Cannot open (e.g. run 42527530380).
  • Clear error when the built site has expired, telling to re-run preview-pr.

Notes

  • On the first run the cleanup also deletes the previews of open PRs made on the old preview branch; they come back on the next push to the PR.
  • Not tested locally; after merging, a manual run with dry-run shows what would be deleted.

🤖 Generated with Claude Code

simonebortolin and others added 2 commits November 14, 2026 18:01
- Add preview-cleanup workflow: deletes every Cloudflare Pages deployment
  except the newest of each open PR (on PR close, after each preview
  deploy, weekly, or manually with dry-run)
- Publish each PR preview on its own pr-<number> branch, so deployments
  can be matched to PRs and the alias URL always shows the latest preview
- Keep the built site for 30 days instead of 1: fork PR previews can wait
  longer than a day for approval, which made the deploy fail
- Fail with a clear message when the built site has expired

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Remove the "if" lines passed as action inputs (the action warned about
  them and they did nothing: the step-level "if" already filters)
- Pin appleboy/telegram-action to v1.1.2 instead of master
- Don't fail the run when the Telegram API resets the connection
- Give the job a read-nothing token

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@simonebortolin
simonebortolin merged commit d0497f4 into main Nov 14, 2026
2 of 3 checks passed
@github-actions

Copy link
Copy Markdown

Preview of the website obtained from the PR: https://ac3b2448.hack-gpon-preview.pages.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant