aws / aws-sam-cli-pipeline-init-templates

MIT No Attribution
44 stars 39 forks source link

GitHub feature branch stacks are created automatically but never deleted #41

Closed brianz closed 2 years ago

brianz commented 3 years ago

The GitHub Actions integration is really nice since it automatically creates new stacks for feature branches (anything which starts with feature). However, those feature branch stacks add up and are not removed automatically. This puts the burden on the developer to 1) realize this behavior and 2) clean up unused feature stacks manually.

Steps to reproduce

  1. Create a SAM Pipeline with GitHub Actions integration (using basic "hello world" SAM app will suffice)
  2. Create a new branch named feature/my-test or feature-my-test
  3. Note in the CloudFormation console that you get a new CFN stack named my-test, which is fully functional
  4. Delete the feature branch
  5. Note that the my-test stack remains

Expected behavior

After I delete a branch, the CFN feature stack is deleted.

Suggestions

This can be accomplished with the new sam delete command and tapping into the delete GitHub action. Trigger the delete GitHub action when the feature branch is deleted. Skip all testing and other building on the delete event. Make sure that the other Actions do not run on the delete GH Action.