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

run the pipeline on any push in the GitHub mirror (!203)

This should close #19.

## changelog
- triggers pipeline in the GitHub mirror on each push
- add `./scripts/get-mirror-pipelines.nu`

## the pipelines
> :exclamation: **Important**
>
> i just had to add `run-mirror-pipeline-everytime` to the list of protected branches and trigger the push with an empty commit and it runs
>
> and then a single call to `nu scripts/get-mirror-pipelines.nu "run-mirror-pipeline-everytime"` gives the table below

| id                                                                             | head_sha                                 | status    | conclusion | run_started_at      |
| ------------------------------------------------------------------------------ | ---------------------------------------- | --------- | ---------- | ------------------- |
| [`14238533729`](https://github.com/dragoon-rs/komodo/actions/runs/14238533729) | 2f32ee59 | completed | success    | 2025-04-03T08:32:31 |
| [`14238724666`](https://github.com/dragoon-rs/komodo/actions/runs/14238724666) | e7587675 | completed | success    | 2025-04-03T08:42:19 |
| [`14240494187`](https://github.com/dragoon-rs/komodo/actions/runs/14240494187) | 3c223dd6 | completed | success    | 2025-04-03T10:13:02 |
| [`14240642763`](https://github.com/dragoon-rs/komodo/actions/runs/14240642763) | cbc1f7f9 | completed | success    | 2025-04-03T10:21:04 |
| [`14240848529`](https://github.com/dragoon-rs/komodo/actions/runs/14240848529) | 7b34fc8a | completed | success    | 2025-04-03T10:32:06 |
parent 4b53a261
No related branches found
No related tags found
1 merge request!203run the pipeline on any push in the GitHub mirror
Pipeline #8300 passed
name: Rust CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
on: [push, pull_request, workflow_dispatch]
jobs:
fmt:
......
......@@ -14,16 +14,7 @@ def "log error" [msg: string] { __log "ERR" "red" $msg }
def "log info" [msg: string] { __log "INF" "cyan" $msg }
def "log ok" [msg: string] { __log " OK" "green" $msg }
let config = open .nu.cfg
| lines
| parse "{key}: {value}"
| transpose --header-row
| into record
if (version).commit_hash != $config.REVISION or (version).version != $config.VERSION {
print --stderr $"(ansi yellow_bold)Warning(ansi reset): unexpected version"
print --stderr $" expected (ansi green)($config.VERSION)@($config.REVISION)(ansi reset)"
print --stderr $" found (ansi red)((version).version)@((version).commit_hash)(ansi reset)"
}
^$nu.current-exe ./scripts/check-nushell-version.nu
def main [base: string, mirror: string, branch: string] {
let base_remote = random uuid
......
let config = open .nu.cfg
| lines
| parse "{key}: {value}"
| transpose --header-row
| into record
if (version).commit_hash != $config.REVISION or (version).version != $config.VERSION {
print --stderr $"(ansi yellow_bold)Warning(ansi reset): unexpected version"
print --stderr $" expected (ansi green)($config.VERSION)@($config.REVISION)(ansi reset)"
print --stderr $" found (ansi red)((version).version)@((version).commit_hash)(ansi reset)"
}
const GH_API_OPTIONS = [
-H "Accept: application/vnd.github+json"
-H "X-GitHub-Api-Version: 2022-11-28"
]
const GITHUB_MIRROR = "dragoon-rs/komodo"
^$nu.current-exe ./scripts/check-nushell-version.nu
def main [branch: string]: [ nothing -> string ] {
let res = gh api ...$GH_API_OPTIONS $"/repos/($GITHUB_MIRROR)/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
$runs
| update id { $"[`($in)`]\(https://github.com/($GITHUB_MIRROR)/actions/runs/($in)\)" }
| update run_started_at { format date "%Y-%m-%dT%H:%M:%S" }
| to md --pretty
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment