-
Notifications
You must be signed in to change notification settings - Fork 28
List workflows when only repo name provided to add command #3373
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>
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 adds support for listing available workflows when a user provides only a repository specification (e.g., owner/repo) without specifying a particular workflow. When this occurs, the system installs the repository package and displays all available workflows to help users discover what's available.
Key changes:
- Adds
isRepoOnlySpec()function to detect when only a repository (not a specific workflow) is provided - Implements
listWorkflowsInPackage()to scan and list all workflow files in an installed package - Introduces
handleRepoOnlySpec()to manage the repo-only flow (install package, list workflows, display examples)
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/cli/spec.go | Adds isRepoOnlySpec() function to identify repository-only specifications |
| pkg/cli/packages.go | Implements listWorkflowsInPackage() to enumerate workflow files in installed packages |
| pkg/cli/add_repo_only_test.go | Adds unit tests for the new repo-only specification handling functionality |
| pkg/cli/add_command.go | Updates command help text and integrates repo-only spec detection into the add workflow flow |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Skip metadata files | ||
| if info.Name() == ".commit-sha" { | ||
| return nil | ||
| } | ||
|
|
Copilot
AI
Nov 6, 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.
This condition is checking a filename against a file that should be .commit-sha, but the previous check already filters out directories and only processes .md files (line 271). Since .commit-sha doesn't end with .md, this check is unreachable and unnecessary.
| // Skip metadata files | |
| if info.Name() == ".commit-sha" { | |
| return nil | |
| } |
| // Extract workflow name (remove .md extension) | ||
| workflowName := strings.TrimSuffix(filepath.Base(path), ".md") | ||
|
|
||
| // Add to list with relative path information | ||
| workflows = append(workflows, relPath) | ||
|
|
||
| if verbose { | ||
| fmt.Printf("Found workflow: %s (name: %s)\n", relPath, workflowName) |
Copilot
AI
Nov 6, 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.
The variable workflowName is computed but never used in a meaningful way. It's only printed in verbose mode (line 293) but doesn't contribute to the function's output. Consider removing this variable or documenting why it's kept for debugging purposes only.
| // Extract workflow name (remove .md extension) | |
| workflowName := strings.TrimSuffix(filepath.Base(path), ".md") | |
| // Add to list with relative path information | |
| workflows = append(workflows, relPath) | |
| if verbose { | |
| fmt.Printf("Found workflow: %s (name: %s)\n", relPath, workflowName) | |
| // Add to list with relative path information | |
| workflows = append(workflows, relPath) | |
| if verbose { | |
| fmt.Printf("Found workflow: %s\n", relPath) |
| } | ||
|
|
||
| fmt.Fprintln(os.Stderr, "") | ||
| fmt.Fprintf(os.Stderr, "Example:\n") |
Copilot
AI
Nov 6, 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 label should be plural 'Examples:' to match the pattern used elsewhere in the codebase (see line 28), or keep it singular but add a colon for consistency.
| fmt.Fprintf(os.Stderr, "Example:\n") | |
| fmt.Fprintf(os.Stderr, "Examples:\n") |
gh aw add owner/repopreviously returned a cryptic error with no workflow discovery mechanism. Now installs the package and lists available workflows with usage examples.Changes
Detection & Routing
isRepoOnlySpec()to detect 2-part specs (owner/repo[@version])AddWorkflows()to route repo-only specs to new handlerWorkflow Enumeration
listWorkflowsInPackage()to walk package directory and enumerate.mdfilesUser Output
handleRepoOnlySpec()to orchestrate: install package → list workflows → format outputaddcommandHelp Text
Example
All existing 3+ part specs unchanged. Backward compatible.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.