Skip to content

gh search prs includes prs from archived repos #8699

@stuart-leitch

Description

@stuart-leitch

Describe the bug

Using gh search prs --state open --owner <OWNER> gets a list of all open PRs across repos in an organisation. However PRs from archived repositories are included. Adding --archived restricts the PRs returned to those in archived repositories, but I can see no way to exclude PRs in archived repos.

You can argue this is an enhancement rather than a bug, but it does seem counterintuitive. I'd expect the default behaviour to exclude archived repos, and the --archived switch to include them.

Additionally it does not seem possible to include whether the repo is archived in the returned data. An alternative fix (which avoids breaking existing behaviour) would be to add and 'archived' field the the allowable json fields so that these PRs can be filtered out post-search.

gh version 2.43.1

Steps to reproduce the behavior

  1. Create a github org 'ghreposearchprsarchived'
  2. Create a new repo
  3. Open a PR in this repo
  4. Archive the repo created in step 2
  5. Create a new repo
  6. Open a PR in this repo
  7. Install and authenticate gh cli for this org
  8. run gh search prs --state open --owner ghreposearchprsarchived
  9. Both PRs created above are listed (expected one)
  10. run gh search prs --state open --owner ghreposearchprsarchived --archived
  11. Only one PR is listed (from the archived repo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-searchrelating to the gh search command

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions