From 6d4fb7beb8132a937a650ed231ac5eaab283de51 Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 17 Feb 2023 11:55:33 +0100 Subject: [PATCH 1/3] WIP --- scripts/ci/changelog/Gemfile | 2 ++ scripts/ci/changelog/Gemfile.lock | 5 +++++ scripts/ci/changelog/bin/changelog | 3 +++ scripts/ci/changelog/templates/change.md.tera | 16 ++++++++-------- .../changelog/templates/changes_client.md.tera | 4 ++-- .../ci/changelog/templates/changes_misc.md.tera | 8 ++++---- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/scripts/ci/changelog/Gemfile b/scripts/ci/changelog/Gemfile index f2d7c3bd716..46b058e3c50 100644 --- a/scripts/ci/changelog/Gemfile +++ b/scripts/ci/changelog/Gemfile @@ -16,6 +16,8 @@ gem 'optparse', '~> 0.1.1' gem 'logger', '~> 1.4' +gem 'changelogerator', '0.10.1' + gem 'test-unit', group: :dev gem 'rubocop', group: :dev, require: false diff --git a/scripts/ci/changelog/Gemfile.lock b/scripts/ci/changelog/Gemfile.lock index 855d7f91a54..893bec54919 100644 --- a/scripts/ci/changelog/Gemfile.lock +++ b/scripts/ci/changelog/Gemfile.lock @@ -4,6 +4,9 @@ GEM addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) ast (2.4.2) + changelogerator (0.10.1) + git_diff_parser (~> 3) + octokit (~> 4) faraday (1.8.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) @@ -64,8 +67,10 @@ GEM PLATFORMS x86_64-darwin-20 + x86_64-darwin-22 DEPENDENCIES + changelogerator (= 0.10.1) git_diff_parser (~> 3) logger (~> 1.4) octokit (~> 4) diff --git a/scripts/ci/changelog/bin/changelog b/scripts/ci/changelog/bin/changelog index 68ec55425ab..11090b37636 100755 --- a/scripts/ci/changelog/bin/changelog +++ b/scripts/ci/changelog/bin/changelog @@ -15,6 +15,9 @@ logger = Logger.new($stdout) logger.level = Logger::DEBUG logger.debug('Starting') +changelogerator_version = `changelogerator --version` +logger.debug(changelogerator_version) + owner = 'paritytech' repo = 'cumulus' ref1 = ARGV[0] diff --git a/scripts/ci/changelog/templates/change.md.tera b/scripts/ci/changelog/templates/change.md.tera index e545b4cec9c..609a038789a 100644 --- a/scripts/ci/changelog/templates/change.md.tera +++ b/scripts/ci/changelog/templates/change.md.tera @@ -1,11 +1,11 @@ {# This macro shows ONE change #} {%- macro change(c, cml="[C]", dot="[P]", sub="[S]") -%} -{%- if c.meta.C and c.meta.C.value >= 5 -%} +{%- if c.meta.C and c.meta.C.agg.max >= 5 -%} {%- set prio = " ‼️ HIGH" -%} -{%- elif c.meta.C and c.meta.C.value >= 3 -%} +{%- elif c.meta.C and c.meta.C.agg.max >= 3 -%} {%- set prio = " ❗️ Medium" -%} -{%- elif c.meta.C and c.meta.C.value < 3 -%} +{%- elif c.meta.C and c.meta.C.agg.max < 3 -%} {%- set prio = " Low" -%} {%- else -%} {%- set prio = "" -%} @@ -13,13 +13,13 @@ {%- set audit = "" -%} {# -{%- if c.meta.D and c.meta.D.value == 1 -%} +{%- if c.meta.D and c.meta.D.D1 -%} {%- set audit = "✅ audited " -%} -{%- elif c.meta.D and c.meta.D.value == 2 -%} +{%- elif c.meta.D and c.meta.D.D2 -%} {%- set audit = "✅ trivial " -%} -{%- elif c.meta.D and c.meta.D.value == 3 -%} +{%- elif c.meta.D and c.meta.D.D3 -%} {%- set audit = "✅ trivial " -%} -{%- elif c.meta.D and c.meta.D.value == 5 -%} +{%- elif c.meta.D and c.meta.D.D5 -%} {%- set audit = "⏳ pending non-critical audit " -%} {%- else -%} {%- set audit = "" -%} @@ -35,7 +35,7 @@ {%- set repo = " " -%} {%- endif -%} {# #} -{%- if c.meta.T and c.meta.T.value == 6 -%} +{%- if c.meta.T and c.meta.T.T6 -%} {%- set xcm = " [✉️ XCM]" -%} {%- else -%} {%- set xcm = "" -%} diff --git a/scripts/ci/changelog/templates/changes_client.md.tera b/scripts/ci/changelog/templates/changes_client.md.tera index 36fb6b9de68..04ceeab39fb 100644 --- a/scripts/ci/changelog/templates/changes_client.md.tera +++ b/scripts/ci/changelog/templates/changes_client.md.tera @@ -5,11 +5,11 @@ {%- for pr in changes | sort(attribute="merged_at") %} {%- if pr.meta.B %} - {%- if pr.meta.B.value == 0 %} + {%- if pr.meta.B.B0 %} {#- We skip silent ones -#} {%- else -%} - {%- if pr.meta.B.value == 5 and not pr.title is containing("ompanion") %} + {%- if pr.meta.B.B5 and not pr.title is containing("ompanion") %} - {{ m_c::change(c=pr) }} {%- endif -%} {% endif -%} diff --git a/scripts/ci/changelog/templates/changes_misc.md.tera b/scripts/ci/changelog/templates/changes_misc.md.tera index cf3b701f2cf..0e5b1fa2005 100644 --- a/scripts/ci/changelog/templates/changes_misc.md.tera +++ b/scripts/ci/changelog/templates/changes_misc.md.tera @@ -4,10 +4,10 @@ {#- First pass to count #} {%- for pr in changes -%} {%- if pr.meta.B %} - {%- if pr.meta.B.value == 0 -%} + {%- if pr.meta.B.B0 -%} {#- We skip silent ones -#} {%- else -%} - {%- if pr.meta.B and pr.meta.B.value != 5 or pr.meta.C or not pr.meta.B %} + {%- if pr.meta.B and not pr.meta.B.B5 or pr.meta.C or not pr.meta.B %} {%- set_global misc_count = misc_count + 1 -%} {%- endif -%} {% endif -%} @@ -24,10 +24,10 @@ There are other misc. changes. You can expand the list below to view them all. {#- The changes are sorted by merge date #} {%- for pr in changes | sort(attribute="merged_at") %} {%- if pr.meta.B and not pr.title is containing("ompanion") %} - {%- if pr.meta.B.value == 0 %} + {%- if pr.meta.B.B0 %} {#- We skip silent ones -#} {%- else -%} - {%- if pr.meta.B and pr.meta.B.value != 5 or pr.meta.C or not pr.meta.B %} + {%- if pr.meta.B and not pr.meta.B.B5 or pr.meta.C or not pr.meta.B %} - {{ m_c::change(c=pr) }} {%- endif -%} {% endif -%} From a73ffbfe293bdf78696026012562efe0bded810a Mon Sep 17 00:00:00 2001 From: Wilfried Kopp Date: Fri, 17 Feb 2023 14:25:14 +0100 Subject: [PATCH 2/3] More fixes --- scripts/ci/changelog/templates/changes_runtime.md.tera | 4 ++-- scripts/ci/changelog/templates/debug.md.tera | 2 +- scripts/ci/changelog/templates/high_priority.md.tera | 8 ++++---- scripts/ci/changelog/templates/host_functions.md.tera | 8 ++++---- scripts/ci/changelog/templates/migrations-db.md.tera | 4 ++-- scripts/ci/changelog/templates/migrations-runtime.md.tera | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/ci/changelog/templates/changes_runtime.md.tera b/scripts/ci/changelog/templates/changes_runtime.md.tera index 9525d73935a..9d9cb530e01 100644 --- a/scripts/ci/changelog/templates/changes_runtime.md.tera +++ b/scripts/ci/changelog/templates/changes_runtime.md.tera @@ -6,11 +6,11 @@ {% for pr in changes | sort(attribute="merged_at") -%} {%- if pr.meta.B and pr.meta.X -%} -{%- if pr.meta.B.value == 0 -%} +{%- if pr.meta.B.B0 -%} {#- We skip silent ones -#} {%- else -%} -{%- if pr.meta.B.value == 1 and pr.meta.X.value == 1 and not pr.title is containing("ompanion") %} +{%- if pr.meta.B.B1 and pr.meta.X.X1 and not pr.title is containing("ompanion") %} - {{ m_c::change(c=pr) }} {%- endif -%} {%- endif -%} diff --git a/scripts/ci/changelog/templates/debug.md.tera b/scripts/ci/changelog/templates/debug.md.tera index 43eb52a84db..4f0b14c00f1 100644 --- a/scripts/ci/changelog/templates/debug.md.tera +++ b/scripts/ci/changelog/templates/debug.md.tera @@ -1,4 +1,4 @@ -{%- set to_ignore = changes | filter(attribute="meta.B.value", value=0) %} +{%- set to_ignore = changes | filter(attribute="meta.B.B0") %} - -{%- if prio -%} +{% if prio -%} {{prio}}: {{text}} {%- else -%} @@ -45,7 +44,7 @@ The changes motivating this priority level are: {%- if pr.meta.C -%} {%- if pr.meta.C.agg.max >= p %} - {{ m_c::change(c=pr) }} -{%- if pr.meta.B and pr.meta.X and pr.meta.B.B1 and pr.meta.X.X1 %} +{%- if pr.meta.B and pr.meta.B.B1 and pr.meta.T and pr.meta.T.T1 %} (RUNTIME) {% endif %}