From 4809bb0305cfb76f9923ba3ec50d9febf6154dfb Mon Sep 17 00:00:00 2001
From: Chevdor <chevdor@users.noreply.github.com>
Date: Mon, 8 May 2023 12:18:25 +0200
Subject: [PATCH] Add a new template to show the list of host functions (#7158)

* Add a new template to show the list of host functions

* Fix release notes template for host functions

---------

Co-authored-by: parity-processbot <>
---
 polkadot/.github/workflows/release-99_bot.yml        |  2 +-
 .../changelog/templates/host_functions-list.md.tera  | 12 ++++++++++++
 .../ci/changelog/templates/host_functions.md.tera    | 11 +++++++----
 3 files changed, 20 insertions(+), 5 deletions(-)
 create mode 100644 polkadot/scripts/ci/changelog/templates/host_functions-list.md.tera

diff --git a/polkadot/.github/workflows/release-99_bot.yml b/polkadot/.github/workflows/release-99_bot.yml
index ac01b7e123f..370ab965310 100644
--- a/polkadot/.github/workflows/release-99_bot.yml
+++ b/polkadot/.github/workflows/release-99_bot.yml
@@ -24,7 +24,7 @@ jobs:
           - name: 'Ledger <> Polkadot Coordination'
             room: '!EoIhaKfGPmFOBrNSHT:web3.foundation'
             pre-release: true
-    
+
     runs-on: ubuntu-latest
     steps:
       - name: Send Matrix message to ${{ matrix.channel.name }}
diff --git a/polkadot/scripts/ci/changelog/templates/host_functions-list.md.tera b/polkadot/scripts/ci/changelog/templates/host_functions-list.md.tera
new file mode 100644
index 00000000000..954d41e40d3
--- /dev/null
+++ b/polkadot/scripts/ci/changelog/templates/host_functions-list.md.tera
@@ -0,0 +1,12 @@
+{%- import "change.md.tera" as m_c -%}
+
+{% for pr in changes | sort(attribute="merged_at") -%}
+
+{%- if pr.meta.B and pr.meta.B.B0 -%}
+{#- We skip silent ones -#}
+{%- else -%}
+    {%- if pr.meta.E and pr.meta.E.E3 -%}
+- {{ m_c::change(c=pr) }}
+    {% endif -%}
+{% endif -%}
+{%- endfor -%}
diff --git a/polkadot/scripts/ci/changelog/templates/host_functions.md.tera b/polkadot/scripts/ci/changelog/templates/host_functions.md.tera
index 170aaf98fec..e38bc5d7182 100644
--- a/polkadot/scripts/ci/changelog/templates/host_functions.md.tera
+++ b/polkadot/scripts/ci/changelog/templates/host_functions.md.tera
@@ -1,4 +1,5 @@
 {%- import "change.md.tera" as m_c -%}
+
 {%- set_global host_fn_count = 0 -%}
 {%- set_global upgrade_first = 0 -%}
 
@@ -22,7 +23,7 @@
 
 {%- if upgrade_first != 0 %}
 ## Node upgrade required
-⚠️ There is a runtime change that will require nodes to be upgraded BEFORE the runtime upgrade.  
+⚠️ There is a runtime change that will require nodes to be upgraded BEFORE the runtime upgrade.
 
 ⚠️ It is critical that you update your client before the chain switches to the new runtime.
 {%- endif %}
@@ -32,10 +33,12 @@
 ## Host functions
 
 {% if host_fn_count == 0 %}
-ℹ️ This release does not contain any new host functions.
+ℹ️ This release does not contain any change related to host functions.
 {% elif host_fn_count == 1 -%}
 {# ---- #}
-ℹ️ The runtimes in this release contain one new **host function**.
+ℹ️ The runtimes in this release contain one change related to **host function**s:
+{% include "host_functions-list.md.tera" -%}
 {%- else -%}
-ℹ️ The runtimes in this release contain {{ host_fn_count }} new **host function{{ host_fn_count | pluralize }}**.
+ℹ️ The runtimes in this release contain {{ host_fn_count }} changes related to **host function**s:
+{% include "host_functions-list.md.tera" -%}
 {%- endif %}
-- 
GitLab