Skip to content

gh run list: add option to return completed and succesful runs only #7235

@koplo199

Description

@koplo199

Describe the feature or problem you’d like to solve

To retrieve the number of the last completed and successful run the command looks like this:
gh run list --json number,conclusion,status -q '.[] | if .conclusion == "success" and .status == "completed" then .number else empty end' | head -1

However, there may not be a successful run in the last 20 runs. Currently the only solution to be confident to retrieve a build number is to set an absurdly hugh --limit value, but this method is a waste of resources in addition of not being resilient.

Proposed solution

A --successful-runs (or so) switch would be perfect here, and would greatly complement the --limit option: for instance gh run list --successful-runs --limit 3 would return the last 3 successful runs.

Additional context

Add any other context like screenshots or mockups are helpful, if applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions