Browse Source

Improve release notes script (#31833)

Improve release notes script

The current release notes script does not handle area labels that
are not two parts, such as ":ml".  As these area labels are rare,
I have simply hard-coded a title for these area labels.  In
addition, the script will not explicitly call out instances where
multiple area labels are present on an issue.
Tom Callahan 7 years ago
parent
commit
3428dc20a4
1 changed files with 14 additions and 2 deletions
  1. 14 2
      dev-tools/es_release_notes.pl

+ 14 - 2
dev-tools/es_release_notes.pl

@@ -46,6 +46,12 @@ my %Group_Labels = (
     'other'          => 'NOT CLASSIFIED',
 );
 
+my %Area_Overrides = (
+    ':ml'            => 'Machine Learning',
+    ':beats'         => 'Beats Plugin',
+    ':Docs'          => 'Docs Infrastructure'
+);
+
 use JSON();
 use Encode qw(encode_utf8);
 
@@ -175,8 +181,14 @@ ISSUE:
         # uncomment for including/excluding PRs already issued in other versions
         # next if grep {$_->{name}=~/^v2/} @{$issue->{labels}};
         my %labels = map { $_->{name} => 1 } @{ $issue->{labels} };
-        my ($header) = map { m{:[^/]+/(.+)} && $1 }
-            grep {/^:/} sort keys %labels;
+        my @area_labels = grep {/^:/} sort keys %labels;
+        my ($header) = map { m{:[^/]+/(.+)} && $1 } @area_labels;
+        if (scalar @area_labels > 1) {
+            $header = "MULTIPLE AREA LABELS";
+        }
+        if (scalar @area_labels == 1 && exists $Area_Overrides{$area_labels[0]}) {
+            $header = $Area_Overrides{$area_labels[0]};
+        }
         $header ||= 'NOT CLASSIFIED';
         for (@Groups) {
             if ( $labels{$_} ) {