CICD-404 · Automatic preview teardown
Encyclopedia · Preview environments and developer experience · All snippets
Previous · CICD-403 · Next · CICD-405
1. Where it fits
- Placement .github/workflows/teardown.yml trigger fragment.
- Prerequisites trusted preview controller, disposable environment and scoped identities for external resources.
- Platforms github-actions.
2. Copy the snippet
yaml
on:
pull_request:
types: [closed]3. How it works
The closed event is the teardown signal. A trusted controller should use the event identity to pick the owned preview and perform scoped, idempotent cleanup.
4. Verify the result
Dispatch a trusted controller from repository metadata. Fork-triggered workflows lack privileged credentials, so use a separately authorized reconciliation path.
Watch for. Place event filters at workflow scope and test an event that should run and an event that should be skipped.
Validation syntax-validated (YAML parse). Status definitions.