Skip to content

Commit d05c71a

Browse files
BagToadCopilotCopilot
authored
Make filtering by bot authors more discoverable (cli#13642)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent f15dce8 commit d05c71a

5 files changed

Lines changed: 20 additions & 9 deletions

File tree

pkg/cmd/issue/list/list.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
7474
Example: heredoc.Doc(`
7575
$ gh issue list --label "bug" --label "help wanted"
7676
$ gh issue list --author monalisa
77+
$ gh issue list --app dependabot
7778
$ gh issue list --assignee "@me"
7879
$ gh issue list --milestone "The big 1.0"
7980
$ gh issue list --search "error no:assignee sort:created-asc"
@@ -110,7 +111,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
110111
cmd.Flags().StringSliceVarP(&opts.Labels, "label", "l", nil, "Filter by label")
111112
cmdutil.StringEnumFlag(cmd, &opts.State, "state", "s", "open", []string{"open", "closed", "all"}, "Filter by state")
112113
cmd.Flags().IntVarP(&opts.LimitResults, "limit", "L", 30, "Maximum number of issues to fetch")
113-
cmd.Flags().StringVarP(&opts.Author, "author", "A", "", "Filter by author")
114+
cmd.Flags().StringVarP(&opts.Author, "author", "A", "", "Filter by author (use --app to filter by a GitHub App)")
114115
cmd.Flags().StringVar(&appAuthor, "app", "", "Filter by GitHub App author")
115116
cmd.Flags().StringVar(&opts.Mention, "mention", "", "Filter by mention")
116117
cmd.Flags().StringVarP(&opts.Milestone, "milestone", "m", "", "Filter by milestone number or title")

pkg/cmd/pr/list/list.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
7272
# List PRs authored by you
7373
$ gh pr list --author "@me"
7474
75+
# List PRs opened by a GitHub App such as Dependabot
76+
$ gh pr list --app dependabot
77+
7578
# List PRs with a specific head branch name
7679
$ gh pr list --head "typo"
7780
@@ -115,7 +118,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
115118
cmd.Flags().StringVarP(&opts.BaseBranch, "base", "B", "", "Filter by base branch")
116119
cmd.Flags().StringVarP(&opts.HeadBranch, "head", "H", "", `Filter by head branch ("<owner>:<branch>" syntax not supported)`)
117120
cmd.Flags().StringSliceVarP(&opts.Labels, "label", "l", nil, "Filter by label")
118-
cmd.Flags().StringVarP(&opts.Author, "author", "A", "", "Filter by author")
121+
cmd.Flags().StringVarP(&opts.Author, "author", "A", "", "Filter by author (use --app to filter by a GitHub App)")
119122
cmd.Flags().StringVar(&appAuthor, "app", "", "Filter by GitHub App author")
120123
cmd.Flags().StringVarP(&opts.Assignee, "assignee", "a", "", "Filter by assignee")
121124
cmd.Flags().StringVarP(&opts.Search, "search", "S", "", "Search pull requests with `query`")

pkg/cmd/search/issues/issues.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func NewCmdIssues(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *c
147147
cmd.Flags().StringVar(&appAuthor, "app", "", "Filter by GitHub App author")
148148
cmdutil.NilBoolFlag(cmd, &opts.Query.Qualifiers.Archived, "archived", "", "Filter based on the repository archived state {true|false}")
149149
cmd.Flags().StringVar(&opts.Query.Qualifiers.Assignee, "assignee", "", "Filter by assignee")
150-
cmd.Flags().StringVar(&opts.Query.Qualifiers.Author, "author", "", "Filter by author")
150+
cmd.Flags().StringVar(&opts.Query.Qualifiers.Author, "author", "", "Filter by author (use --app to filter by a GitHub App)")
151151
cmd.Flags().StringVar(&opts.Query.Qualifiers.Closed, "closed", "", "Filter on closed at `date`")
152152
cmd.Flags().StringVar(&opts.Query.Qualifiers.Commenter, "commenter", "", "Filter based on comments by `user`")
153153
cmd.Flags().StringVar(&opts.Query.Qualifiers.Comments, "comments", "", "Filter on `number` of comments")

pkg/cmd/search/prs/prs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func NewCmdPrs(f *cmdutil.Factory, runF func(*shared.IssuesOptions) error) *cobr
158158
cmd.Flags().StringVar(&appAuthor, "app", "", "Filter by GitHub App author")
159159
cmdutil.NilBoolFlag(cmd, &opts.Query.Qualifiers.Archived, "archived", "", "Filter based on the repository archived state {true|false}")
160160
cmd.Flags().StringVar(&opts.Query.Qualifiers.Assignee, "assignee", "", "Filter by assignee")
161-
cmd.Flags().StringVar(&opts.Query.Qualifiers.Author, "author", "", "Filter by author")
161+
cmd.Flags().StringVar(&opts.Query.Qualifiers.Author, "author", "", "Filter by author (use --app to filter by a GitHub App)")
162162
cmd.Flags().StringVar(&opts.Query.Qualifiers.Closed, "closed", "", "Filter on closed at `date`")
163163
cmd.Flags().StringVar(&opts.Query.Qualifiers.Commenter, "commenter", "", "Filter based on comments by `user`")
164164
cmd.Flags().StringVar(&opts.Query.Qualifiers.Comments, "comments", "", "Filter on `number` of comments")

skills/gh/SKILL.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,19 @@ Pass `--repo OWNER/REPO` (`-R`) to override the resolved CWD repo.
4848

4949
- `gh search issues|prs|code|repos|commits|users` uses GitHub's search
5050
index and accepts the full search syntax (`is:open`, `author:`,
51-
`label:`, `repo:owner/name`, `in:title`, ...). Pass the entire query as
52-
one quoted string, the same way you would for `--search`:
53-
`gh search issues "is:open author:foo repo:cli/cli"`. Prefer it for
51+
`label:`, `repo:owner/name`, `in:title`, ...). Pass each qualifier as
52+
its own bare token, not as one quoted string:
53+
`gh search issues repo:cli/cli is:open author:monalisa` works, but
54+
`gh search issues "repo:cli/cli is:open"` is treated as a single keyword (parsed as `repo:"cli/cli is:open"`)
55+
and fails with `Invalid search query`. Quote only multi-word free text
56+
(`gh search issues "broken feature"`). Most qualifiers also have a
57+
dedicated flag (`--repo`, `--author`, `--label`, ...). Prefer search for
5458
anything cross-repo or filtered by author/label.
55-
- `gh issue list --search "..."` and `gh pr list --search "..."` accept
56-
the same syntax but are scoped to one repo.
59+
- `gh issue list --search "..."` and `gh pr list --search "..."` take the
60+
query as one quoted string (it is a flag value) and are scoped to one repo.
61+
- Bots author as GitHub Apps, so `--author dependabot` matches nothing. Use
62+
`--app dependabot` (on `pr`/`issue list` and `search prs|issues`; expands
63+
to `author:app/<slug>`) or `--author "dependabot[bot]"`.
5764

5865
## Issue types, sub-issues, and relationships
5966

0 commit comments

Comments
 (0)