Developers want ephemeral preview environments for each PR, destroyed on close.
AdvancedScenarioGitHub Actions
Answer
Situation read → Per-PR environments with lifecycle.
What I'd do →
- On
pull_request(opened, synchronize) deploy to namespacepr-${{ github.event.number }}using Helm with a unique host name and post the URL as a PR comment. - On
pull_request: types: [closed]runhelm uninstalland delete the namespace. - Add a nightly cleanup of namespaces older than N days as a safety net, plus resource quotas.
Why → Previews shorten review cycles, but orphaned environments cost money without the cleanup job.
Interview tip → The safety-net sweeper is what distinguishes a production-grade design.
More on GitHub Actions
What are workflows, jobs, steps and actions in GitHub Actions?BeginnerWhat events can trigger a workflow?BeginnerWhat is the difference between `pull_request` and `pull_request_target`?AdvancedWhat is a runner, and how do GitHub-hosted and self-hosted runners differ?BeginnerHow do you pass data between steps and between jobs?IntermediateHow does a build matrix work?Intermediate