Skip to content

gh release list: Add a flag to include only drafts #8578

@mertant

Description

@mertant

Describe the feature or problem you’d like to solve

As a CLI user, I want to find (and eventually delete) outdated release drafts. To this end, I want to use gh release list to find ONLY drafts.

Currently, the gh release list includes a flag --exclude-drafts to exclude draft releases. I need to do the inverse of this: exclude non-drafts.

Proposed solution

Add a new flag to gh release list, named for example --only-drafts. Its effect should be to filter out any release where isDraft is false.

Its behaviour should be equivalent to the current --exclude-drafts, in that the filter is applied before --limit, but the filtering condition should be the opposite.

Additional context

While it is currently technically possible to achieve the same result through the use of gh release view and jq, that would require N+1 commands rather than just the one. The single-command filtering seems like a relatively basic use case to extend gh release list with, especially seeing that the equal but opposite functionality is already implemented.

Another potential workaround currently is to grep the output for Draft, but that seems hacky and unreliable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-releaserelating to the gh release command

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions