getnighthawk icon indicating copy to clipboard operation
getnighthawk copied to clipboard

Add PR preview pruning and retention management

Open Yashisinghal285 opened this issue 5 months ago • 5 comments

Description

This PR adds preview pruning and retention management for PR preview deployments.

What changed

  • Adds PREVIEW_RETENTION_LIMIT = 6
  • Implements pruning of old pr-preview/pr-* directories
  • Uses sparse checkout for efficient gh-pages maintenance
  • Ensures only 6 most recent previews are kept
  • Adds notifications when previews are pruned
  • Preserves cleanup-on-close behavior

Issue

Fixes #377

Notes for Reviewers

  • Workflow runs after PR preview deployment
  • Only gh-pages pr-preview directory is modified
  • Safe for concurrent PR workflows

Checklist

  • [x] I tested the workflow locally / validated syntax
  • [x] I understand this modifies GitHub Actions behavior

Signed commits

  • [x] Yes, I signed my commits

Yashisinghal285 avatar Jun 16 '26 19:06 Yashisinghal285

🚀 Preview deployment: https://layer5io.github.io/getnighthawk/pr-preview/pr-378/

Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment here

github-actions[bot] avatar Jun 16 '26 19:06 github-actions[bot]

Hi maintainers 👋
This PR implements preview pruning and retention management as per #377.
Ready for review when convenient.

Yashisinghal285 avatar Jun 16 '26 19:06 Yashisinghal285

Hi maintainers 👋

I noticed the failing lint check appears to be timing out during package loading (context deadline exceeded).

This PR only modifies build-and-preview-site.yml and docs/_data/discuss/nighthawk.json, and does not modify .github/workflows/ci.yml, which runs the lint job.

Please let me know if you'd like any changes from my side or if there is anything else I can help investigate.

Thanks! 🙌

Yashisinghal285 avatar Jun 21 '26 07:06 Yashisinghal285

I approved this PR by mistake.

Bhumikagarggg avatar Jun 27 '26 19:06 Bhumikagarggg

@Sbragul26 Thanks for the review! I've updated the workflow by replacing git push || true with git push as suggested. Please take another look when you have a chance.

Yashisinghal285 avatar Jun 28 '26 03:06 Yashisinghal285

Hi @Sbragul26, @Bhumikagarggg,

Just following up on this PR. I've addressed all the requested review comments, and the PR now has no merge conflicts and an approval. The remaining failing lint check appears to be unrelated to the changes in this PR.

Could you please let me know if anything else is required from my side? If everything looks good, I'd really appreciate it if this PR could be merged when you have time. Thank you!

Yashisinghal285 avatar Jul 09 '26 16:07 Yashisinghal285

Hi @Sbragul26, @Bhumikagarggg, @banana-three-join, @hortison 👋

Just a friendly follow-up on this PR. I've addressed all the requested review comments, the PR has an approval, and there are no merge conflicts. The remaining lint check appears to be unrelated to the changes in this PR.

If everything looks good, I'd really appreciate it if you could take a final look and merge it when you have time. Please let me know if there's anything else you'd like me to update.

Thank you!

Yashisinghal285 avatar Jul 16 '26 12:07 Yashisinghal285