-
Notifications
You must be signed in to change notification settings - Fork 32
Add actionable suggestions to "workflow not found" errors #3896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pkg/cli/commands.go
Outdated
| "Check for typos in the workflow name", | ||
| } | ||
| return "", errors.New(console.FormatErrorWithSuggestions( | ||
| fmt.Sprintf("workflow '%s' not found in local .github/workflows or components", fileOrWorkflowName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot avoid components terminology
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed "or components" terminology from error messages in commit 9717db0.
Updated error message:
✗ workflow 'nonexistent-workflow' not found in local .github/workflows
Suggestions:
• Run 'gh aw status' to see all available workflows
• Create a new workflow with 'gh aw new nonexistent-workflow'
• Check for typos in the workflow name
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot Lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the user experience by adding actionable, contextual suggestions to "workflow not found" errors throughout the CLI. A new FormatErrorWithSuggestions function is introduced in the console package to provide consistent formatting for error messages with bullet-pointed suggestions. The implementation spans 12 files, updating error handling in commands like compile, run, logs, enable/disable, and workflow resolution, ensuring users receive helpful guidance when workflows cannot be found.
Key changes:
- New
FormatErrorWithSuggestionshelper function in console package with comprehensive test coverage - Contextually-appropriate error suggestions across 7+ CLI commands (compile, run, logs, enable, workflows, resolver)
- Smart error detection in main command to prevent double-formatting of errors already containing suggestions
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/console/console.go | Added FormatErrorWithSuggestions function to format errors with bullet-pointed actionable suggestions |
| pkg/console/console_test.go | Added comprehensive unit tests covering multiple scenarios for error formatting with suggestions |
| pkg/workflow/resolve.go | Updated three error locations in ResolveWorkflowName with contextual suggestions for missing markdown files, lock files, and workflow names |
| pkg/workflow/resolve_test.go | Updated test expectation to match new error format containing suggestions |
| pkg/cli/commands.go | Enhanced resolveWorkflowFile error with suggestions and updated log message to remove "components" terminology |
| pkg/cli/resolver.go | Added suggestions to workflow file not found errors in ResolveWorkflowPath |
| pkg/cli/logs.go | Updated workflow lookup error in logs command with contextual suggestions for workflow ID vs GitHub Actions name |
| pkg/cli/workflows.go | Added suggestions to GitHub workflow lookup errors in getWorkflowStatus |
| pkg/cli/run_command.go | Enhanced two error locations with suggestions: lock file missing and remote workflow validation |
| pkg/cli/enable.go | Added suggestions to workflow not found errors in enable/disable toggle functionality |
| pkg/cli/compile_command.go | Modified error handling to print errors directly, preserving pre-formatted suggestions |
| cmd/gh-aw/main.go | Added smart detection to avoid double-formatting errors that already contain suggestions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for _, suggestion := range suggestions { | ||
| output.WriteString(" • " + suggestion + "\n") | ||
| } |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The trailing newline in the formatted error with suggestions output may cause inconsistent spacing. When this error is later printed with fmt.Fprintln(), it will add an additional newline, resulting in a blank line after the suggestions section. Consider removing the trailing \n on line 447 to maintain consistent spacing.
| for _, suggestion := range suggestions { | |
| output.WriteString(" • " + suggestion + "\n") | |
| } | |
| formatted := make([]string, len(suggestions)) | |
| for i, suggestion := range suggestions { | |
| formatted[i] = " • " + suggestion | |
| } | |
| output.WriteString(strings.Join(formatted, "\n")) |
|
@copilot lint |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Task: Add actionable suggestions to "workflow not found" errors
Status: ✅ Complete
All acceptance criteria have been met. The implementation adds helpful, actionable suggestions to all "workflow not found" errors across the CLI.
Recent Changes
Formatting fix (per review feedback)
make fmtto fix trailing whitespace inpkg/console/console.goRemoved "components" terminology (per review feedback)
pkg/cli/commands.goto remove "or components"pkg/cli/run_command.goto remove "or components"Changes Summary
1. Console Package Enhancement
FormatErrorWithSuggestionsfunction topkg/console/console.gopkg/console/console_test.go2. CLI Commands Updated (7+ locations)
pkg/cli/commands.go(line 82) - Workflow resolution errorspkg/cli/resolver.go(line 43) - Workflow file not found errorspkg/cli/logs.go(line 362) - Logs command workflow lookuppkg/cli/workflows.go(line 137) - GitHub workflow lookup errorspkg/cli/run_command.go(lines 125, 670) - Run command workflow errorspkg/cli/enable.go(line 170) - Enable/disable command errorspkg/cli/compile_command.go- Fixed error formatting to preserve suggestions3. Workflow Package Updated
pkg/workflow/resolve.go(lines 45, 54, 74) - All three error locations4. Main Command Updated
cmd/gh-aw/main.go- Smart error detection to avoid double formatting5. Testing
Example Output
Current:
Contextual Suggestions
Different commands provide contextually appropriate suggestions:
gh aw status,gh aw new, checking for typosgh aw compileorgh aw compile <workflow-id>Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.