-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Summary
When automating workspace creation (e.g., from GitHub Actions triggered by PR labels), the coder create command can hang waiting for user input or take longer than necessary by waiting for the build to complete.
Use Case
We want to automatically create workspaces on behalf of users from a GitHub Action when a specific label is added to a PR. In this automation context:
-
No interactive prompts: The CLI should fail fast with a clear error if any required input is missing, rather than hanging indefinitely waiting for user input that will never come.
-
Async creation: We don't need to wait for the workspace build to complete - we just need to trigger the creation and return immediately so the GitHub Action can complete quickly.
Proposed Solution
Add two new flags to coder create:
--no-wait
Returns immediately after triggering workspace creation. The workspace build continues in the background.
coder create my-workspace --template my-template -y --no-wait--no-prompt
Disables all interactive prompts. The command will:
- Use default values for parameters that have defaults
- Fail with a clear error message if:
- Workspace name is not provided
- Template name is not provided
- Required parameters without defaults are missing
- Preset selection is needed but no default preset exists
coder create my-workspace --template my-template --no-prompt -yCombined usage for automation
coder create my-workspace --template my-template --no-prompt --no-wait -yAdditional Context
The --no-wait flag already exists on coder start, so this would bring consistency to the CLI. The --no-prompt flag provides explicit control over non-interactive behavior beyond what -y offers (which only skips confirmation prompts, not selection prompts).