feat(requires): support variable references in enum constraints (#2678)

This commit is contained in:
Valentin Maerten
2026-03-21 11:32:02 +01:00
committed by GitHub
parent 19d8fae5f9
commit 8b6aca5722
16 changed files with 268 additions and 16 deletions

View File

@@ -674,14 +674,12 @@ tasks:
```yaml
tasks:
# Simple requirements
deploy:
requires:
vars: [API_KEY, ENVIRONMENT]
cmds:
- ./deploy.sh
# Requirements with enum validation
advanced-deploy:
requires:
vars:
@@ -693,6 +691,17 @@ tasks:
cmds:
- echo "Deploying to {{.ENVIRONMENT}} with log level {{.LOG_LEVEL}}"
- ./deploy.sh
# Requirements with enum from variable reference
reusable-deploy:
requires:
vars:
- name: ENVIRONMENT
enum:
ref: .ALLOWED_ENVS
cmds:
- ./deploy.sh
```
See [Prompting for missing variables interactively](/docs/guide#prompting-for-missing-variables-interactively)