Conversation
…oop; fix add_command test broken by #20375 - pkg/cli/fetch.go: The fetchRemoteWorkflow function had two nearly identical blocks for trying fallback paths ("workflows/" and ".github/workflows/"). Consolidate them into a single loop over candidate prefixes, removing ~12 lines of duplicate code while preserving identical behavior. - pkg/cli/add_command_test.go: TestNewAddCommand was asserting the old text "Add one or more workflows" which was changed to "Add one or more agentic workflows" by PR #20375. Update the assertion to match the new wording. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
This PR simplifies recently modified code (from §22919210941) to improve clarity and fix a broken test.
Files Changed
pkg/cli/fetch.go— Merge two identical fallback-path lookup blocks into a looppkg/cli/add_command_test.go— Fix assertion broken by PR fix(cli): standardize --help flag descriptions and "agentic workflow" terminology #20375's terminology changeImprovements Made
1. Reduced Duplication in
fetch.gofetchRemoteWorkflowhad two near-identical blocks for retrying a short workflow name under common directory prefixes (workflows/and.github/workflows/). Both blocks performed the same steps: build the alt path, ensure.mdsuffix, log, attempt download, return on success. The only difference was the prefix string.Consolidated into a single loop over
[]string{"workflows/", ".github/workflows/"}, reducing ~25 lines to ~13 with no behavioral change:2. Fixed Broken Test in
add_command_test.goPR #20375 changed the
addcommand's long description from "Add one or more workflows" to "Add one or more agentic workflows", but the corresponding test assertion was not updated. This causedTestNewAddCommandto fail on every run.Changes Based On
Recent changes from:
Testing
TestNewAddCommandnow passesmake build)go test ./pkg/cli/passesTestWasmGolden_CompileFixturesfailures are pre-existing (unrelated to these changes)References:
Warning
The following domain was blocked by the firewall during workflow execution:
releaseassets.githubusercontent.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.