release-notes: show warning on recent major/minor tag

This commit is contained in:
Rylan Polster 2020-12-28 10:37:09 -05:00
parent 5b360f35c5
commit a33f4e0fd1
3 changed files with 20 additions and 0 deletions

View File

@ -17,6 +17,10 @@ module Homebrew
Print the merged pull requests on Homebrew/brew between two Git refs.
If no <previous_tag> is provided it defaults to the latest tag.
If no <end_ref> is provided it defaults to `origin/master`.
If `--markdown` and a <previous_tag> are passed, an extra line containg
a link to the Homebrew blog will be adding to the output. Additionally,
a warning will be shown if the latest minor release was less than one month ago.
EOS
switch "--markdown",
description: "Print as a Markdown list."
@ -29,6 +33,15 @@ module Homebrew
args = release_notes_args.parse
previous_tag = args.named.first
if previous_tag.present?
previous_tag_date = Date.parse Utils.popen_read(
"git", "-C", HOMEBREW_REPOSITORY, "log", "-1", "--format=%aI", previous_tag.sub(/\d+$/, "0")
)
opoo "The latest major/minor release was less than one month ago." if previous_tag_date > (Date.today << 1)
end
previous_tag ||= Utils.popen_read(
"git", "-C", HOMEBREW_REPOSITORY, "tag", "--list", "--sort=-version:refname"
).lines.first.chomp

View File

@ -1197,6 +1197,10 @@ Print the merged pull requests on Homebrew/brew between two Git refs.
If no *`previous_tag`* is provided it defaults to the latest tag.
If no *`end_ref`* is provided it defaults to `origin/master`.
If `--markdown` and a *`previous_tag`* are passed, an extra line containg
a link to the Homebrew blog will be adding to the output. Additionally,
a warning will be shown if the latest minor release was less than one month ago.
* `--markdown`:
Print as a Markdown list.

View File

@ -1672,6 +1672,9 @@ Use \fBstackprof\fR instead of \fBruby\-prof\fR (the default)\.
.SS "\fBrelease\-notes\fR [\fIoptions\fR] [\fIprevious_tag\fR] [\fIend_ref\fR]"
Print the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\.
.
.P
If \fB\-\-markdown\fR and a \fIprevious_tag\fR are passed, an extra line containg a link to the Homebrew blog will be adding to the output\. Additionally, a warning will be shown if the latest minor release was less than one month ago\.
.
.TP
\fB\-\-markdown\fR
Print as a Markdown list\.