From 1519af4972252a80a8e25d1ec57aea4b9432e0e9 Mon Sep 17 00:00:00 2001 From: STEVAN Antoine <antoine.stevan@isae-supaero.fr> Date: Wed, 2 Apr 2025 09:52:11 +0000 Subject: [PATCH] use gh-cli to pull mirror run information (dragoon/komodo!201) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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│de4266c0603a05c675a951de1886d4c646b6b738│completed│success │4 months ago 1 │11950604920│202d8bcc715b332569eed59bc8d7d725ce5518d1│completed│success │4 months ago 2 │11950873603│702cd5eb40336bc31edf2f0cd656b27726cee2f9│completed│success │4 months ago 3 │12028360471│57a96c028ece1143e0254eacace3a28f7c74021e│completed│success │4 months ago 4 │12028432364│076028753d04889d4df025cf3afbbf8c59fd6ac0│completed│success │4 months ago 5 │12028781541│f2a76fbb25adf832263add178d634b6694dda37f│completed│success │4 months ago 6 │12631165433│11a5b59d192f8193819279a910fd61cf3538de29│completed│success │2 months ago 7 │13008608156│cc412625046a879ada4ccd14463253fa860de7a0│completed│success │2 months ago 8 │13033206333│5511404f551e20678443ccd940635b6af4bd329d│completed│success │2 months ago 9 │13113244065│ab0d9a8ba69e4873dea2945d9a49b6d67ffe5b8b│completed│success │2 months ago 10│13679188387│3c8afac45d70e1aff96959bc6956d3502d99e7ff│completed│success │3 weeks ago 11│14191103891│b5381fdad4030f49340fadbbb78c354f0c3afc84│completed│success │a day ago 12│14214853530│b7e2d99d68773fe4d2140a4c801398748f1439d8│completed│success │an hour ago 13│14215431531│0d7a5cd6bc4829afcfb2fd25a24a8b5a19b85fc3│completed│success │32 minutes ago ──┴───────────┴────────────────────────────────────────┴─────────┴──────────┴────────────── ``` --- scripts/check-mirror.nu | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/scripts/check-mirror.nu b/scripts/check-mirror.nu index 76cc4d9c..9ebc4ad2 100644 --- a/scripts/check-mirror.nu +++ b/scripts/check-mirror.nu @@ -1,3 +1,8 @@ +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 ] { $"(ansi $color)($in)(ansi reset)" } @@ -52,4 +57,29 @@ def main [base: string, mirror: string, branch: string] { } else { 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 } -- GitLab