1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37: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:
Antoine Stevan 2023-07-31 21:42:54 +02:00 committed by GitHub
parent 3ee56c6ec3
commit fec7f95619
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 15 deletions

View file

@ -50,19 +50,40 @@ def main [
let body = $"Please add your new features and breaking changes to the release notes
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"
git clone git@github.com:nushell/nushell.github.io $repo --origin nushell --branch main --single-branch
log info "creating release branch"
git -C $repo checkout -b $branch nushell/main
log info "creating release note from template"
$env.CURRENT_FILE
| path dirname
| path join "template.md"
| open
| str replace --all --string "{{VERSION}}" $version
| save --force $blog_path
log info "writing release note"
$release_note | save --force $blog_path
log info "commiting release note"
git -C $repo add $blog_path
@ -79,7 +100,7 @@ by opening PRs against the `release-notes-($version)` branch."
error make --unspanned {
msg: ([
$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")
}
}

View file

@ -1,6 +1,8 @@
#!/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 = (
$env.CURRENT_FILE | path dirname | path join "list-merged-prs"
)
@ -18,7 +20,7 @@ def main [] {
$changelogs | each {|changelog|
[
$"## ($changelog.title)"
(^$list_merged_prs_script $changelog.repo --pretty)
(^$list_merged_prs_script $changelog.repo --pretty $date)
] | str join "\n"
}
| str join "\n\n"

View file

@ -10,15 +10,15 @@ def md-link [
# list all merged PRs since last release
def main [
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`
--pretty: bool # pretty-print for the MarkDown release not
--no-author: bool # do not group the contributions by author
] {
let date = (
if $date == null { (date now) - 3wk + 1day } else { $date }
| date format "%Y-%m-%d"
)
let date = $date | default ((date now) - 4wk) | 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 {
$"merged:>($date)"