Skip to content

gh run list with branch option #5440

Closed
Closed

Description

@Aherbeth

Hi !

I have a little bug since a couple of days. i tested it with the 2.5 and the 2.7.0 version.
I try to get a list of a particular run, from a particular repo on a particular branch.
So, my command looks like that :

gh run list --repo myAccount/Myrepo --workflow "NodeJS Build CI" --branch master

When I take a look at the results i see this :

STATUS  NAME                                                                               WORKFLOW         BRANCH  EVENT              ID          ELAPSED  AGE
✓       Merge pull request #1949 from  xxxxxxxxxxxx  NodeJS Build CI  master  push               2088995471  3m35s    7d
✓       Merge pull request #1947 from  xxxxxxxxxxxx  NodeJS Build CI  master  workflow_dispatch  2075877841  2m46s    10d
✓       Merge pull request #1947 from  xxxxxxxxxxxx  NodeJS Build CI  master  pull_request       2075858515  2m34s    10d
✓       Merge pull request #1947 from  xxxxxxxxxxxx  NodeJS Build CI  master  push               2075858401  2m58s    10d
✓       Merge pull request #1946 from  xxxxxxxxxxxx  NodeJS Build CI  master  workflow_dispatch  2070425930  3m16s    11d

As you can see, the "newest" run is 7 days old

But when I try this command without the branch specification

gh run list --repo myAccount/Myrepo --workflow "NodeJS Build CI"

I get this results :

STATUS  NAME                                                                            WORKFLOW         BRANCH                                     EVENT              ID          ELAPSED  AGE
✓       Merge pull request #1953 from xxxxx/release/1.190.0                          NodeJS Build CI  master                                     workflow_dispatch  2148813763  2m50s    1h
✓       feat(EMAC-1441): use minimalForDisplay setting                                  NodeJS Build CI  EMAC-1441_hide_zone_if_not_enough_teasers  pull_request       2148653947  2m15s    2h
✓       Merge pull request #1954 from xxxxxx/EMAC-1414_v4-menus                       NodeJS Build CI  develop                                    push               2148229287  3m14s    3h
✓       feat(EMAC-1414): rename type                                                    NodeJS Build CI  EMAC-1414_v4-menus                         pull_request       2148180413  2m55s    3h
✓       Merge pull request #1953 from xxxxxx/release/1.190.0                          NodeJS Build CI  master                                     push               2147778396  3m28s    5h

As you can see, i have a newer run for this workflow, for this branch, but that doesn't appear in the result of the first command.
And the second result is the one that reflect the actions activity.

Is there a bug ?

Thanks a lot in advance for your time and work on this useful tool !
And sorry if by any means I am the Problem behind this :D

Activity

  1. mislav commented on Apr 11, 2022

    @mislav
    Contributor

    Hi, thanks for reporting!

    It's an implementation detail for this API endpoint, but I think that the branch parameter switches the query to be ElasticSearch-backed, and the ES index is sometimes out of date with the latest state in GitHub database.

    What to do about this? Well, ES index inconsistencies exist from time to time, but they usually iron themselves out by time, for example after the next workflow runs you might start to get consistent results again.

    If this keeps being a persistent issue for you and affects your workflow, you should contact GitHub Support about this, as we can't provide support for various API features through this repository. And as a workaround in CLI you can request data without the filters and then filter in the client:

    # print only results that have "master" as branch
    gh run list --repo cli/cli --workflow "goreleaser" | awk -F'\t' '$5 == "master"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageneeds to be reviewed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions