Skip to content
Snippets Groups Projects
Commit 1519af49 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

use gh-cli to pull mirror run information (!201)

This is to complete the `check-mirror.nu` script with information about the CI runs.

The current output of
```bash
nu scripts/check-mirror.nu ...[
    https://gitlab.isae-supaero.fr/dragoon/komodo
    https://github.com/dragoon-rs/komodo
    main
]
```
is
```
[INF] adding remotes
[INF] fetching
[INF] cleaning
[ OK] mirror is up to date
[INF] pulling mirror runs
#─┬────id─────┬────────────────head_sha────────────────┬─status──┬conclusion┬run_started_at
0 │11950217125│de4266c0│completed│success   │4 months ago
1 │11950604920│202d8bcc│completed│success   │4 months ago
2 │11950873603│702cd5eb│completed│success   │4 months ago
3 │12028360471│57a96c02│completed│success   │4 months ago
4 │12028432364│07602875│completed│success   │4 months ago
5 │12028781541│f2a76fbb│completed│success   │4 months ago
6 │12631165433│11a5b59d│completed│success   │2 months ago
7 │13008608156│cc412625│completed│success   │2 months ago
8 │13033206333│5511404f│completed│success   │2 months ago
9 │13113244065│ab0d9a8b│completed│success   │2 months ago
10│13679188387│3c8afac4│completed│success   │3 weeks ago
11│14191103891│b5381fda│completed│success   │a day ago
12│14214853530│b7e2d99d│completed│success   │an hour ago
13│14215431531│0d7a5cd6│completed│success   │32 minutes ago
──┴───────────┴────────────────────────────────────────┴─────────┴──────────┴──────────────
```
parent 0d7a5cd6
No related branches found
No related tags found
1 merge request!201use gh-cli to pull mirror run information
Pipeline #8252 passed with stages
in 4 minutes and 25 seconds
const GH_API_OPTIONS = [
-H "Accept: application/vnd.github+json"
-H "X-GitHub-Api-Version: 2022-11-28"
]
def "str color" [color: string]: [ string -> string ] { def "str color" [color: string]: [ string -> string ] {
$"(ansi $color)($in)(ansi reset)" $"(ansi $color)($in)(ansi reset)"
} }
...@@ -52,4 +57,29 @@ def main [base: string, mirror: string, branch: string] { ...@@ -52,4 +57,29 @@ def main [base: string, mirror: string, branch: string] {
} else { } else {
log ok "mirror is up to date" log ok "mirror is up to date"
} }
log info "pulling mirror runs"
let res = gh api ...$GH_API_OPTIONS /repos/dragoon-rs/komodo/actions/runs | from json
let runs = $res.workflow_runs
| where head_branch == $branch
| select id head_sha status conclusion run_started_at
| into datetime run_started_at
| sort-by run_started_at
$env.config.table = {
mode: compact,
index_mode: always,
show_empty: true,
padding: { left: 0, right: 0 },
header_on_separator: true,
trim: {
methodology: wrapping,
wrapping_try_keep_words: true,
},
abbreviated_row_count: null,
footer_inheritance: false,
}
print $runs
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment