Skip to content

feat: improve run command error output for missing workflow inputs#20951

Merged
pelikhan merged 4 commits intomainfrom
copilot/improve-run-command-output
Mar 14, 2026
Merged

feat: improve run command error output for missing workflow inputs#20951
pelikhan merged 4 commits intomainfrom
copilot/improve-run-command-output

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

The run command error for missing inputs gave no hint on how to actually provide them, and incorrectly flagged required inputs that have a default as missing.

Changes

  • Syntax hint: Error message now includes gh aw run <workflow> -F <input>=<value> examples for each truly-missing required input
  • Default-aware validation: Required inputs with a default value are no longer reported as missing — the default will be used by GitHub Actions anyway
  • Defaults in valid inputs list: Inputs with defaults now show [default: <value>] in the listing
  • Sorted output: Valid inputs are listed alphabetically for consistency

Example

Before:

✗ failed to run workflow 'release': Missing required input(s): release_type

Valid inputs:
  release_type (required): Release type (patch, minor, or major)

After:

✗ failed to run workflow 'release': Missing required input(s): release_type

Valid inputs:
  release_type (required): Release type (patch, minor, or major)

To set required inputs, use:
  gh aw run release -F release_type=<value>

Copilot AI and others added 3 commits March 13, 2026 03:54
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>
@pelikhan pelikhan marked this pull request as ready for review March 14, 2026 15:14
Copilot AI review requested due to automatic review settings March 14, 2026 15:14
@pelikhan pelikhan merged commit 9fef1a7 into main Mar 14, 2026
48 of 50 checks passed
@pelikhan pelikhan deleted the copilot/improve-run-command-output branch March 14, 2026 15:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 required inputs with a default as 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>"},
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants