mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
fix the date schedule in the release scripts (#561)
* pass the date as an argument to `get-full-changelog` * simplify the computation of default date in `list-merged-prs` * switch to the 4 week-schedule by default * show the queried date before printing merged PRs * remove `ansi link` as it's an extra command * create-pr: show PR parts, explore the note and ask for confirmation
This commit is contained in:
parent
3ee56c6ec3
commit
fec7f95619
3 changed files with 38 additions and 15 deletions
|
@ -50,19 +50,40 @@ def main [
|
||||||
let body = $"Please add your new features and breaking changes to the release notes
|
let body = $"Please add your new features and breaking changes to the release notes
|
||||||
by opening PRs against the `release-notes-($version)` branch."
|
by opening PRs against the `release-notes-($version)` branch."
|
||||||
|
|
||||||
|
log info "creating release note from template"
|
||||||
|
let release_note = $env.CURRENT_FILE
|
||||||
|
| path dirname
|
||||||
|
| path join "template.md"
|
||||||
|
| open
|
||||||
|
| str replace --all --string "{{VERSION}}" $version
|
||||||
|
|
||||||
|
log info $"branch: ($branch)"
|
||||||
|
log info $"blog: ($blog_path | str replace $repo "" | path split | skip 1 | path join)"
|
||||||
|
log info $"title: ($title)"
|
||||||
|
|
||||||
|
match (["yes" "no"] | input list --fuzzy "Inspect the release note document? ") {
|
||||||
|
"yes" => { $release_note | explore },
|
||||||
|
"no" | "" | _ => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
match (["no" "yes"] | input list --fuzzy "Open release note PR? ") {
|
||||||
|
"yes" => {},
|
||||||
|
"no" | "" | _ => {
|
||||||
|
log warning "aborting."
|
||||||
|
return
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
log info "setting up nushell.github.io repo"
|
log info "setting up nushell.github.io repo"
|
||||||
git clone git@github.com:nushell/nushell.github.io $repo --origin nushell --branch main --single-branch
|
git clone git@github.com:nushell/nushell.github.io $repo --origin nushell --branch main --single-branch
|
||||||
|
|
||||||
log info "creating release branch"
|
log info "creating release branch"
|
||||||
git -C $repo checkout -b $branch nushell/main
|
git -C $repo checkout -b $branch nushell/main
|
||||||
|
|
||||||
log info "creating release note from template"
|
log info "writing release note"
|
||||||
$env.CURRENT_FILE
|
$release_note | save --force $blog_path
|
||||||
| path dirname
|
|
||||||
| path join "template.md"
|
|
||||||
| open
|
|
||||||
| str replace --all --string "{{VERSION}}" $version
|
|
||||||
| save --force $blog_path
|
|
||||||
|
|
||||||
log info "commiting release note"
|
log info "commiting release note"
|
||||||
git -C $repo add $blog_path
|
git -C $repo add $blog_path
|
||||||
|
@ -79,7 +100,7 @@ by opening PRs against the `release-notes-($version)` branch."
|
||||||
error make --unspanned {
|
error make --unspanned {
|
||||||
msg: ([
|
msg: ([
|
||||||
$out.stderr
|
$out.stderr
|
||||||
$"please open the PR manually from a browser (ansi blue_underline)($pr_url | ansi link --text 'here')(ansi reset)"
|
$"please open the PR manually from a browser (ansi blue_underline)($pr_url)(ansi reset)"
|
||||||
] | str join "\n")
|
] | str join "\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
|
|
||||||
def main [] {
|
def main [
|
||||||
|
date?: datetime # the date of the last release (default to 4 weeks ago, excluded)
|
||||||
|
] {
|
||||||
let list_merged_prs_script = (
|
let list_merged_prs_script = (
|
||||||
$env.CURRENT_FILE | path dirname | path join "list-merged-prs"
|
$env.CURRENT_FILE | path dirname | path join "list-merged-prs"
|
||||||
)
|
)
|
||||||
|
@ -18,7 +20,7 @@ def main [] {
|
||||||
$changelogs | each {|changelog|
|
$changelogs | each {|changelog|
|
||||||
[
|
[
|
||||||
$"## ($changelog.title)"
|
$"## ($changelog.title)"
|
||||||
(^$list_merged_prs_script $changelog.repo --pretty)
|
(^$list_merged_prs_script $changelog.repo --pretty $date)
|
||||||
] | str join "\n"
|
] | str join "\n"
|
||||||
}
|
}
|
||||||
| str join "\n\n"
|
| str join "\n\n"
|
||||||
|
|
|
@ -10,15 +10,15 @@ def md-link [
|
||||||
# list all merged PRs since last release
|
# list all merged PRs since last release
|
||||||
def main [
|
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 3 weeks ago, excluded)
|
date?: datetime # the date of the last release (default to 4 weeks ago, excluded)
|
||||||
--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: bool # pretty-print for the MarkDown release not
|
--pretty: bool # pretty-print for the MarkDown release not
|
||||||
--no-author: bool # do not group the contributions by author
|
--no-author: bool # do not group the contributions by author
|
||||||
] {
|
] {
|
||||||
let date = (
|
let date = $date | default ((date now) - 4wk) | date format "%Y-%m-%d"
|
||||||
if $date == null { (date now) - 3wk + 1day } else { $date }
|
|
||||||
| date format "%Y-%m-%d"
|
let since = (date now | date format %F | into datetime) - ($date | into datetime)
|
||||||
)
|
log info $"listing PRs in ($repo) since ($date) \(($since) ago\)"
|
||||||
|
|
||||||
let query = if $label == null {
|
let query = if $label == null {
|
||||||
$"merged:>($date)"
|
$"merged:>($date)"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue