Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Summary
Automatically cleans up inactive PR environments after a configurable TTL period (default: 14 days). Environments can be excluded using the
lifecycle-keep!label.Default: Feature is disabled by default and starts in dry-run mode when enabled.
Namespace Labels
TTL behavior is controlled by namespace labels:
lfc/ttl-enable"true"or"false"lfc/ttl-expireAtUnix"1737043200000"lfc/ttl-expireAt"2025-01-16"Examples
Static Environment (TTL Disabled)
PR Environment (TTL Enabled - Default)
PR with Keep Label (TTL Disabled)
Configuration
TTL cleanup is configured in
global_config.ttl_cleanup:{ "enabled": false, "dryRun": true, "inactivityDays": 14, "checkIntervalMinutes": 240, "commentTemplate": "This environment has been inactive for {inactivityDays} days and will be automatically cleaned up.", "excludedRepositories": [] }Fields:
enabled- Master switch (default:false)dryRun- Log actions without executing (default:true)inactivityDays- Days before cleanup (default:14)checkIntervalMinutes- Job frequency (default:240= 4 hours)excludedRepositories- Skip these repos (e.g.,["org/repo"])Using Keep Labels
To prevent cleanup:
lifecycle-keep!label to your PR or use your custom labels configured inglobal_config.labelslfc/ttl-enable=falseTo re-enable TTL:
lfc/ttl-enable=truewith new expirationAdmin API
View config:
Trigger cleanup: