Print empty array for `gh cache list` when `--json` is provided by williammartin · Pull Request #9883 · cli/cli · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions acceptance/testdata/workflow/cache-list-empty.txtar
2 changes: 1 addition & 1 deletion pkg/cmd/cache/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func listRun(opts *ListOptions) error {
return fmt.Errorf("%s Failed to get caches: %w", opts.IO.ColorScheme().FailureIcon(), err)
}

if len(result.ActionsCaches) == 0 {
if len(result.ActionsCaches) == 0 && opts.Exporter == nil {
return cmdutil.NewNoResultsError(fmt.Sprintf("No caches found in %s", ghrepo.FullName(repo)))
}

Expand Down
62 changes: 61 additions & 1 deletion pkg/cmd/cache/list/list_test.go