mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
Allow listing merged PRs by milestone (#773)
Also changes `date?` parameter to `--date` and slight code refactoring
This commit is contained in:
parent
bccdab661a
commit
351691f118
1 changed files with 25 additions and 8 deletions
|
@ -11,21 +11,38 @@ def md-link [
|
||||||
# list all merged PRs since last release
|
# list all merged PRs since last release
|
||||||
export def main [
|
export def main [
|
||||||
repo: string # the name of the repo, e.g. `nushell/nushell`
|
repo: string # the name of the repo, e.g. `nushell/nushell`
|
||||||
date?: datetime # the date of the last release (default to 4 weeks ago, excluded)
|
--date: datetime # the date of the last release (default to 4 weeks ago, excluded, if no milestone is set)
|
||||||
|
--milestone: string # search PRs by milestone
|
||||||
--label: string # the label to filter the PRs by, e.g. `good-first-issue`
|
--label: string # the label to filter the PRs by, e.g. `good-first-issue`
|
||||||
--pretty # pretty-print for the MarkDown release not
|
--pretty # pretty-print for the MarkDown release not
|
||||||
--no-author # do not group the contributions by author
|
--no-author # do not group the contributions by author
|
||||||
] {
|
] {
|
||||||
let date = $date | default ((date now) - 4wk) | format date "%Y-%m-%d"
|
mut query_parts = []
|
||||||
|
|
||||||
let since = (date now | format date %F | into datetime) - ($date | into datetime)
|
let date = if $date == null and $milestone == null {
|
||||||
log info $"listing PRs in ($repo) since ($date) \(($since) ago\)"
|
(date now) - 4wk
|
||||||
|
|
||||||
let query = if $label == null {
|
|
||||||
$"merged:>($date)"
|
|
||||||
} else {
|
} else {
|
||||||
$"merged:>($date) label:($label)"
|
$date
|
||||||
}
|
}
|
||||||
|
| format date "%Y-%m-%d"
|
||||||
|
|
||||||
|
if $date != null {
|
||||||
|
let since = (date now | format date %F | into datetime) - ($date | into datetime)
|
||||||
|
log info $"listing PRs in ($repo) since ($date) \(($since) ago\)"
|
||||||
|
$query_parts ++= [ $"merged:>($date)" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if $milestone != null {
|
||||||
|
log info $"listing PRs in milestone ($milestone)"
|
||||||
|
$query_parts ++= [ $'milestone:"($milestone)"' ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if $label != null {
|
||||||
|
log info $"listing PRs with label ($label)"
|
||||||
|
$query_parts ++= [ $'label:($label)' ]
|
||||||
|
}
|
||||||
|
|
||||||
|
let query = $query_parts | str join ' '
|
||||||
|
|
||||||
let prs = (
|
let prs = (
|
||||||
gh --repo $repo pr list
|
gh --repo $repo pr list
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue