ADd ci scripts

main
Julius Riegel 2 months ago
parent 5cd37811ff
commit 04401bd60c

@ -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}}

@ -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"
}
}

@ -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: {}

@ -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")

Loading…
Cancel
Save