Changed dev-tools/es_release_notes to:
* remove markdown support * prefer PRs over issues * include related issues in the list * always use section headers if there is a header
This commit is contained in:
parent
269b91c688
commit
1455988d91
|
@ -24,7 +24,7 @@ use utf8;
|
||||||
|
|
||||||
my $Base_URL = 'https://api.github.com/repos/';
|
my $Base_URL = 'https://api.github.com/repos/';
|
||||||
my $User_Repo = 'elasticsearch/elasticsearch/';
|
my $User_Repo = 'elasticsearch/elasticsearch/';
|
||||||
my $Issue_URL = "http://github.com/${User_Repo}issues/issue/";
|
my $Issue_URL = "http://github.com/${User_Repo}issues/";
|
||||||
|
|
||||||
my @Groups = qw(breaking feature enhancement bug regression doc test);
|
my @Groups = qw(breaking feature enhancement bug regression doc test);
|
||||||
my %Group_Labels = (
|
my %Group_Labels = (
|
||||||
|
@ -51,8 +51,6 @@ my $version = shift @ARGV
|
||||||
dump_labels("Unknown version '$version'")
|
dump_labels("Unknown version '$version'")
|
||||||
unless $All_Labels{$version};
|
unless $All_Labels{$version};
|
||||||
|
|
||||||
my $format = shift @ARGV || "html";
|
|
||||||
|
|
||||||
my $issues = fetch_issues($version);
|
my $issues = fetch_issues($version);
|
||||||
dump_issues( $version, $issues );
|
dump_issues( $version, $issues );
|
||||||
|
|
||||||
|
@ -69,45 +67,48 @@ sub dump_issues {
|
||||||
|
|
||||||
for my $group ( @Groups, 'other' ) {
|
for my $group ( @Groups, 'other' ) {
|
||||||
my $group_issues = $issues->{$group} or next;
|
my $group_issues = $issues->{$group} or next;
|
||||||
$format eq 'html' and print "<h2>$Group_Labels{$group}</h2>\n\n<ul>\n";
|
print "<h2>$Group_Labels{$group}</h2>\n\n<ul>\n";
|
||||||
$format eq 'markdown' and print "## $Group_Labels{$group}\n\n";
|
|
||||||
|
|
||||||
for my $header ( sort keys %$group_issues ) {
|
for my $header ( sort keys %$group_issues ) {
|
||||||
my $header_issues = $group_issues->{$header};
|
my $header_issues = $group_issues->{$header};
|
||||||
my $prefix = "<li>";
|
my $prefix = "<li>";
|
||||||
if ($format eq 'html') {
|
if ($header) {
|
||||||
if ( $header && @$header_issues > 1 ) {
|
print "<li>$header:<ul>";
|
||||||
print "<li>$header:<ul>";
|
|
||||||
$prefix = "<li>";
|
|
||||||
}
|
|
||||||
elsif ($header) {
|
|
||||||
$prefix = "<li>$header: ";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for my $issue (@$header_issues) {
|
for my $issue (@$header_issues) {
|
||||||
my $title = $issue->{title};
|
my $title = $issue->{title};
|
||||||
$title=~s{`([^`]+)`}{<code>$1</code>}g
|
$title =~ s{`([^`]+)`}{<code>$1</code>}g;
|
||||||
if $format eq 'html';
|
|
||||||
|
|
||||||
if ( $issue->{state} eq 'open' ) {
|
if ( $issue->{state} eq 'open' ) {
|
||||||
$title .= " [OPEN]";
|
$title .= " [OPEN]";
|
||||||
}
|
}
|
||||||
|
unless ( $issue->{pull_request} ) {
|
||||||
|
$title .= " [ISSUE]";
|
||||||
|
}
|
||||||
my $number = $issue->{number};
|
my $number = $issue->{number};
|
||||||
$format eq 'markdown' and print encode_utf8( "* "
|
|
||||||
|
print encode_utf8( $prefix
|
||||||
. $title
|
. $title
|
||||||
. qq( [#$number](${Issue_URL}${number})\n)
|
. qq[ <a href="${Issue_URL}${number}">#${number}</a>] );
|
||||||
);
|
|
||||||
$format eq 'html' and print encode_utf8( $prefix
|
if ( my $related = $issue->{related_issues} ) {
|
||||||
. $title
|
my %uniq = map { $_ => 1 } @$related;
|
||||||
. qq[ <a href="${Issue_URL}${number}">#${number}</a></li>\n]
|
print keys %uniq > 1
|
||||||
);
|
? " (issues: "
|
||||||
|
: " (issue: ";
|
||||||
|
print join ", ",
|
||||||
|
map {qq[<a href="${Issue_URL}${_}">#${_}</a>]}
|
||||||
|
sort keys %uniq;
|
||||||
|
print ")";
|
||||||
|
}
|
||||||
|
print "</li>\n";
|
||||||
}
|
}
|
||||||
if ($format eq 'html' && $header && @$header_issues > 1 ) {
|
if ($header) {
|
||||||
print "</li></ul></li>\n";
|
print "</ul></li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$format eq 'html' and print "</ul>";
|
print "</ul>";
|
||||||
print "\n\n"
|
print "\n\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +117,7 @@ sub fetch_issues {
|
||||||
#===================================
|
#===================================
|
||||||
my $version = shift;
|
my $version = shift;
|
||||||
my @issues;
|
my @issues;
|
||||||
|
my %seen;
|
||||||
for my $state ( 'open', 'closed' ) {
|
for my $state ( 'open', 'closed' ) {
|
||||||
my $page = 1;
|
my $page = 1;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -128,15 +130,25 @@ sub fetch_issues {
|
||||||
. '&page='
|
. '&page='
|
||||||
. $page )
|
. $page )
|
||||||
or die "Couldn't fetch issues for version '$version'";
|
or die "Couldn't fetch issues for version '$version'";
|
||||||
last unless @$tranche;
|
|
||||||
push @issues, @$tranche;
|
push @issues, @$tranche;
|
||||||
|
|
||||||
|
for my $issue (@$tranche) {
|
||||||
|
next unless $issue->{pull_request};
|
||||||
|
for ( $issue->{body} =~ m{(?:#|${User_Repo}issues/)(\d+)}g ) {
|
||||||
|
$seen{$_}++;
|
||||||
|
$issue->{related_issues} ||= [];
|
||||||
|
push @{$issue}{related_issues}, $_;
|
||||||
|
}
|
||||||
|
}
|
||||||
$page++;
|
$page++;
|
||||||
|
last unless @$tranche;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my %group;
|
my %group;
|
||||||
ISSUE:
|
ISSUE:
|
||||||
for my $issue (@issues) {
|
for my $issue (@issues) {
|
||||||
|
next if $seen{ $issue->{number} } && !$issue->{pull_request};
|
||||||
my %labels = map { $_->{name} => 1 } @{ $issue->{labels} };
|
my %labels = map { $_->{name} => 1 } @{ $issue->{labels} };
|
||||||
my $header = $issue->{title} =~ s/^([^:]+):\s+// ? $1 : '';
|
my $header = $issue->{title} =~ s/^([^:]+):\s+// ? $1 : '';
|
||||||
for (@Groups) {
|
for (@Groups) {
|
||||||
|
|
Loading…
Reference in New Issue