diff --git a/content/config/nushell/config.nu.tmpl b/content/config/nushell/config.nu.tmpl index a946b79..2871b03 100644 --- a/content/config/nushell/config.nu.tmpl +++ b/content/config/nushell/config.nu.tmpl @@ -462,3 +462,9 @@ use task.nu {{#if-installed git}} source git.nu {{/if-installed}} + +{{#if-installed glab}} +{{#if-installed gh}} +use ci.nu +{{/if-installed}} +{{/if-installed}} diff --git a/content/config/nushell/scripts/ci.nu b/content/config/nushell/scripts/ci.nu new file mode 100644 index 0000000..d3e48e0 --- /dev/null +++ b/content/config/nushell/scripts/ci.nu @@ -0,0 +1,50 @@ +# notify when the latest ci pipeline completes +export def notify [] { + while (info | get status) == "running" { + sleep 1sec; + }; + let name = ($env.PWD | path basename) + notify-send $"CI ($name)" "Job completed" +} + + +export def watch [] { + loop { + while (info | get status) != "running" { + sleep 10sec; + } + notify + } +} + +export def info [] { + if (get-ci) == "gitlab" { + glab ci get -F json | from json + } else { + gh run list --json conclusion,name,startedAt,status | from json | first + } +} + +# notify in background +export def notify-bg [] { + use task.nu + task spawn -l "ci-notify" { + ci notify + } +} + +export def watch-bg [] { + use task.nu + task spawn -l "ci-watch" { + ci watch + } +} + +export def get-ci [] { + let remote = (git remote get-url --all origin) + if ($remote | str contains gitlab) { + "gitlab" + } else if ($remote | str contains github.com) { + "github" + } +} diff --git a/content/config/pueue/pueue.yml b/content/config/pueue/pueue.yml new file mode 100644 index 0000000..431245a --- /dev/null +++ b/content/config/pueue/pueue.yml @@ -0,0 +1,32 @@ +client: + restart_in_place: false + read_local_logs: true + show_confirmation_questions: false + show_expanded_aliases: false + dark_mode: false + max_status_lines: null + status_time_format: '%H:%M:%S' + status_datetime_format: |- + %Y-%m-%d + %H:%M:%S +daemon: + default_parallel_tasks: 16 + pause_group_on_failure: false + pause_all_on_failure: false + callback: null + env_vars: {} + callback_log_lines: 10 + shell_command: null +shared: + pueue_directory: null + runtime_directory: null + alias_file: null + use_unix_socket: true + unix_socket_path: null + host: 127.0.0.1 + port: '6924' + pid_path: null + daemon_cert: null + daemon_key: null + shared_secret_path: null +profiles: {} diff --git a/content/config/silo.dir.lua b/content/config/silo.dir.lua index 367dd35..8ca27c9 100644 --- a/content/config/silo.dir.lua +++ b/content/config/silo.dir.lua @@ -22,6 +22,7 @@ config:needs("starship", "starship") config:needs("lvim", "lvim") config:needs("lvim", "lvim") config:needs("git", "nushell/scripts/git.nu") +config:needs("pueue", "pueue") config:needs("pueue", "nushell/scripts/task.nu") config:needs("pueue", "systemd/user/pueued.service")