Every PR should get its own preview environment, cleaned up automatically.
IntermediateScenarioScale, Submodules, LFS and GitHub Automation
Answer
Situation read → Environments must be created on open and destroyed on close.
What I'd do →
- Trigger on
pull_requestwith typesopened,synchronize,reopenedandclosed. - Name resources with the PR number (
app-pr-482) and deploy to a namespace or stack. - On
closed, run a teardown job; also run a nightly sweeper for leftovers. - Post the preview URL as a PR comment and use a GitHub deployment for status.
Why → Reviewers test real behaviour, and cost stays bounded by cleanup.
Interview tip → Never give fork PRs access to deployment secrets.
More on Scale, Submodules, LFS and GitHub Automation
A monorepo has 4 GB of history and developers only touch one service. How do you make their day-to-day faster?IntermediateDesigners commit PSD and video assets, and the repo keeps growing. How do you move them to Git LFS?IntermediateYour GitHub LFS bandwidth quota is exhausted and CI pulls fail. What do you do?AdvancedA repository uses a submodule. How does a developer get the right version of it?BeginnerSubmodules, subtree or a package manager for sharing code between repos?IntermediateCI cannot clone a private submodule: authentication fails in `actions/checkout`.Intermediate