Skip to content

New: [AEA-6536] - Added support for cleaning up arbitrary PR stacks#713

Open
MatthewPopat-NHS wants to merge 4 commits intomainfrom
AEA-6536
Open

New: [AEA-6536] - Added support for cleaning up arbitrary PR stacks#713
MatthewPopat-NHS wants to merge 4 commits intomainfrom
AEA-6536

Conversation

@MatthewPopat-NHS
Copy link
Copy Markdown
Contributor

Summary

  • ✨ New Feature

Copilot AI review requested due to automatic review settings April 29, 2026 14:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for deleting PR-related CloudFormation stacks that include additional suffix segments beyond the previously supported -sandbox pattern, ensuring more PR stack variants can be cleaned up automatically.

Changes:

  • Extended PR stack name matching to allow arbitrary suffixes (e.g. -front-door, -stateful).
  • Added a unit test covering deletion of multiple PR stack variants for the same PR number.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/cdkConstructs/src/stacks/deleteUnusedStacks.ts Broadens PR stack name regex to match additional PR stack naming variants.
packages/cdkConstructs/tests/stacks/deleteUnusedStacks.test.ts Adds coverage for deleting multiple stacks that share the same PR id but differ by suffix.

Comment thread packages/cdkConstructs/src/stacks/deleteUnusedStacks.ts Outdated
Comment thread packages/cdkConstructs/tests/stacks/deleteUnusedStacks.test.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for cleaning up PR CloudFormation stacks that include arbitrary suffixes (e.g. -front-door, -stateful) and reduces repeated GitHub API lookups when multiple stacks belong to the same PR.

Changes:

  • Broaden PR stack name matching to allow an arbitrary suffix after the PR number.
  • Add an in-memory PR state cache so multiple stacks for the same PR don’t trigger multiple GitHub API requests.
  • Add a test case covering deletion of multiple same-PR stacks with different suffixes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/cdkConstructs/src/stacks/deleteUnusedStacks.ts Expands PR stack regex matching and introduces PR state caching during a run.
packages/cdkConstructs/tests/stacks/deleteUnusedStacks.test.ts Adds coverage for deleting multiple stacks sharing the same PR id but different suffixes.

Comment thread packages/cdkConstructs/src/stacks/deleteUnusedStacks.ts
Comment thread packages/cdkConstructs/src/stacks/deleteUnusedStacks.ts Outdated
MatthewPopat-NHS and others added 2 commits April 29, 2026 16:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

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.

2 participants