feat: improve run command error output for missing workflow inputs#20951
Merged
feat: improve run command error output for missing workflow inputs#20951
run command error output for missing workflow inputs#20951Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Show `gh aw run <workflow> -F <input>=<value>` syntax hint in error - Ignore required inputs that have a default value (treat as optional) - Show default values in the valid inputs list - Sort inputs alphabetically in valid inputs display - Add tests for new behavior including negative assertions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
March 14, 2026 15:13
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Improves the run command’s validation error output for workflow-dispatch inputs by avoiding false “missing required” reports when defaults exist and by adding more actionable guidance in error messages.
Changes:
- Treats
requiredinputs with adefaultas not missing during validation. - Sorts and enriches the “Valid inputs” list, including
[default: …]annotations. - Adds a syntax-hint section with
gh aw run <workflow> -F <input>=<value>examples.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/cli/run_workflow_validation.go | Updates missing-input detection to be default-aware, sorts valid inputs output, appends defaults, and adds syntax-hint examples. |
| pkg/cli/run_input_validation_test.go | Extends test cases to cover default-aware required inputs and validates new messaging content. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+252
to
265
| // Derive the workflow name for the syntax hint | ||
| workflowName := strings.TrimSuffix(filepath.Base(markdownPath), ".md") | ||
| var syntaxExamples []string | ||
| for _, name := range sortedNames { | ||
| def := workflowInputs[name] | ||
| if def.Required && def.Default == nil { | ||
| syntaxExamples = append(syntaxExamples, fmt.Sprintf(" gh aw run %s -F %s=<value>", workflowName, name)) | ||
| } | ||
| } | ||
|
|
||
| validInputsMsg := "\nValid inputs:\n" + strings.Join(inputDescriptions, "\n") | ||
| if len(syntaxExamples) > 0 { | ||
| validInputsMsg += "\n\nTo set required inputs, use:\n" + strings.Join(syntaxExamples, "\n") | ||
| } |
Comment on lines
+185
to
210
| { | ||
| name: "required input with default shown in valid inputs list", | ||
| lockContent: `name: "Test Workflow" | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| missing_required: | ||
| description: 'Must be set' | ||
| required: true | ||
| type: string | ||
| defaulted: | ||
| description: 'Has a default' | ||
| required: true | ||
| default: patch | ||
| type: string | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - run: echo "test" | ||
| `, | ||
| providedInputs: []string{}, | ||
| expectError: true, | ||
| errorContains: []string{"Missing required input(s)", "missing_required", "default: patch"}, | ||
| errorNotContains: []string{"gh aw run test-workflow -F defaulted=<value>"}, | ||
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The
runcommand error for missing inputs gave no hint on how to actually provide them, and incorrectly flaggedrequiredinputs that have adefaultas missing.Changes
gh aw run <workflow> -F <input>=<value>examples for each truly-missing required inputdefaultvalue are no longer reported as missing — the default will be used by GitHub Actions anyway[default: <value>]in the listingExample
Before:
After: