You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh run list should report in a predictable order #6678
Describe the feature or problem you’d like to solve
If I use gh run list twice to check up on progress, the order of the runs can change. Can the result be sorted, for example by start time, and then workflow name?
Proposed solution
Sort by start time then workflow name so that sequential runs are more understandable.
Sorry, more information: I use a git alias to format the output the way I want. The plain gh run list output order is different than my alias' order. The alias order can shift around. I'm not sure what determines the ordering:
% gh run list --limit 6
STATUS TITLE WORKFLOW BRANCH EVENT ID ELAPSED AGE
* fix: when checking source existence for remapping, zipfil... Quality nedbat/limit-implicit-combine-recursion-w-metacov push 3593979659 1m23s 1m
* fix: when checking source existence for remapping, zipfil... Coverage nedbat/limit-implicit-combine-recursion-w-metacov push 3593979655 1m23s 1m
* fix: when checking source existence for remapping, zipfil... Tests nedbat/limit-implicit-combine-recursion-w-metacov push 3593979653 1m23s 1m
✓ fix: when checking source existence for remapping, zipfil... Quality nedbat/limit-implicit-combine-recursion-w-metacov push 3593536538 6m32s 53m
✓ fix: when checking source existence for remapping, zipfil... Tests nedbat/limit-implicit-combine-recursion-w-metacov push 3593536535 41m47s 53m
✓ fix: when checking source existence for remapping, zipfil... Coverage nedbat/limit-implicit-combine-recursion-w-metacov push 3593536529 23m35s 53m
% git runs 6
STATUS RESULT WORKFLOW STARTED COMMIT
in_progress Quality 1 minute ago fix: when checking source existe... https://github.com/nedbat/coveragepy/actions/runs/3593979659
queued Tests 1 minute ago fix: when checking source existe... https://github.com/nedbat/coveragepy/actions/runs/3593979653
queued Coverage 1 minute ago fix: when checking source existe... https://github.com/nedbat/coveragepy/actions/runs/3593979655
completed success Quality 53 minutes ago fix: when checking source existe... https://github.com/nedbat/coveragepy/actions/runs/3593536538
completed success Coverage 53 minutes ago fix: when checking source existe... https://github.com/nedbat/coveragepy/actions/runs/3593536529
completed success Tests 53 minutes ago fix: when checking source existe... https://github.com/nedbat/coveragepy/actions/runs/3593536535
The (wildly over-engineered) git alias is:
runs = "!f() { \
gh run list \
--limit ${1:-10} \
--branch $(git rev-parse --abbrev-ref HEAD) \
--json status,conclusion,url,startedAt,workflowName,displayTitle \
--template '\
{{- tablerow \"STATUS\" \"RESULT\" \"WORKFLOW\" \"STARTED\" \"COMMIT\" \"\" -}} \
{{- range . -}} \
{{- $ccolor := \"green+b\" -}} \
{{- if eq .conclusion \"failure\"}}{{ $ccolor = \"red+b\" }}{{ end -}} \
{{- tablerow \
.status \
(.conclusion | color $ccolor) \
(.workflowName | truncate 15 | color \"white+b\") \
(timeago .startedAt) \
(.displayTitle | truncate 35 | color \"white\") \
(.url | color \"blue+d\") \
-}}\
{{- end }}'; \
}; f"
Thanks for reporting! We use this API endpoint which doesn't have an explicit parameter to specify a desired order. I must admit I do not know exactly what the default order is on (I presume some kind of createdAt key). I can ask, but in general, I would not rely on the order being stable in these results. The list of latest runs, even when filtered per-branch, can be is highly volatile.
@nedbat I've checked with Hubbers who work on the platform side and our best guess so far is:
Specifying --branch filter makes the query go to Elastic Search index (instead of to a database);
The ES index has default sort created desc;
Depending on the granularity of the created field, if two items were created within the same second (or same millisecond, which is also possible), then the stability of their order is not guaranteed.
I understand that this doesn't help you right now, but I just wanted to note this here for posterity.
Activity
nedbat commentedon Dec 1, 2022
Sorry, more information: I use a git alias to format the output the way I want. The plain
gh run listoutput order is different than my alias' order. The alias order can shift around. I'm not sure what determines the ordering:The (wildly over-engineered) git alias is:
nedbat commentedon Dec 1, 2022
Here are two consecutive runs of my alias:
Notice that even the three completed runs have changed order!
mislav commentedon Dec 1, 2022
Thanks for reporting! We use this API endpoint which doesn't have an explicit parameter to specify a desired order. I must admit I do not know exactly what the default order is on (I presume some kind of
createdAtkey). I can ask, but in general, I would not rely on the order being stable in these results. The list of latest runs, even when filtered per-branch, can be is highly volatile.nedbat commentedon Dec 1, 2022
Thanks, is there anything I can do to sort them myself? The Golang templates can do a lot, but maybe not that much...
mislav commentedon Dec 1, 2022
Right now we don't have any template helpers to perform sorting based on a custom key, sorry. Would that be a useful thing to add?
mislav commentedon Dec 1, 2022
@nedbat I've checked with Hubbers who work on the platform side and our best guess so far is:
--branchfilter makes the query go to Elastic Search index (instead of to a database);created desc;createdfield, if two items were created within the same second (or same millisecond, which is also possible), then the stability of their order is not guaranteed.I understand that this doesn't help you right now, but I just wanted to note this here for posterity.
nedbat commentedon Dec 1, 2022
It's at least comforting my engineer's brain to have a reason, if not a solution :D
fix: add tolerance for ambiguous behavior in `gh run list` (#4162)
fix: add tolerance for ambiguous behavior in `gh run list` (openai#4162)
fix: add tolerance for ambiguous behavior in `gh run list` (openai#4162)
fix: add tolerance for ambiguous behavior in `gh run list` (#4162)
fix: add tolerance for ambiguous behavior in `gh run list` (openai#4162)
fix: add tolerance for ambiguous behavior in `gh run list` (#4162)
[vLLM] Bound nightly-wheels wheel search to the last 30 days
[vLLM] Paginate the nightly-wheels created window instead of a fixed …