1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

prototype of TWiN automation script

This commit is contained in:
Darren Schroeder 2021-04-26 16:32:27 -05:00
parent 617a3d7e7e
commit e4b0c2644a

55
this_week_in_nu.nu Normal file
View file

@ -0,0 +1,55 @@
# fetch https://api.github.com/repos/nushell/nushell/pulls?q=is%3Apr+merged%3A%3E%3D2021-04-20+ | select url user.login title body
# fetch https://api.github.com/search/issues?q=repo:nushell/vscode-nushell-lang+is:pr+is:merged+merged:%3E2021-04-01 | get items | select url user.login title body
# Repos to monitor
# TODO - group-by user so all there PRs are on one line
# TODO - automatically figure out what week it is
def do-work [] {
let site_table = [
[site url
]; [Nushell nushell
] [Extension vscode-nushell-lang
] [Documentation nushell.github.io
] [Wasm demo
] [Nu_Scripts nu_scripts
] [RFCs rfcs]
# ] [Jupyter jupyter]
]
let query_prefix = "https://api.github.com/search/issues?q=repo:nushell/"
let query_date = $(seq date --days 7 -r | last)
# let query_select = " | get items | select url user.login title"
let query_suffix = $(build-string "+is:pr+is:merged+merged:%3E" $query_date)
# echo $site_table
let entries = $(echo $site_table | each {
let query_string = $(build-string $query_prefix $it.url $query_suffix)
# debug string
# build-string 'fetch ' $query_string $(char nl) | autoview
# fetch $query_string
let site_json = $(fetch $query_string | get items | select url user.login title)
# echo $site_json | autoview
build-string '## ' $(echo $it.site) $(char nl) $(char nl)
if $(= $site_json | empty?) {
} {
echo $site_json | each {
build-string '- ' $it.user_login ' created [' $it.title '](' $it.url ')' $(char nl)
} | str collect
build-string $(char nl)
}
# We need 2 seconds between fetches or github's api limiting will limit us
sleep 2sec
})
if $(= $entries | empty?) {
} {
echo $entries | str collect
}
}
build-string '# This week in Nushell #' $(char nl) $(char nl)
do-work | str collect