Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Fix release notes templates (#6697)
Browse files Browse the repository at this point in the history
* WIP

* Fix templates

- fix conditions to fetch misc PRs
- render the misc section only if required
- add html comment to help debugging
- add a new API section to T2 labels
  • Loading branch information
chevdor authored Feb 10, 2023
1 parent 3d908b2 commit 2a9ed40
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 3 deletions.
2 changes: 2 additions & 0 deletions scripts/ci/changelog/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ gem 'optparse', '~> 0.1.1'

gem 'logger', '~> 1.4'

gem 'changelogerator', '0.9.1'

gem 'test-unit', group: :dev

gem 'rubocop', group: :dev, require: false
7 changes: 6 additions & 1 deletion scripts/ci/changelog/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ GEM
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
changelogerator (0.9.1)
git_diff_parser (~> 3)
octokit (~> 4)
faraday (1.8.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -64,8 +67,10 @@ GEM

PLATFORMS
x86_64-darwin-20
x86_64-darwin-22

DEPENDENCIES
changelogerator (= 0.9.1)
git_diff_parser (~> 3)
logger (~> 1.4)
octokit (~> 4)
Expand All @@ -76,4 +81,4 @@ DEPENDENCIES
toml (~> 0.3.0)

BUNDLED WITH
2.2.22
2.4.6
6 changes: 6 additions & 0 deletions scripts/ci/changelog/templates/change.md.tera
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,11 @@
{%- set repo = " " -%}
{%- endif -%}

{%- if c.meta.T and c.meta.T.value == 6 -%}
{%- set xcm = " [✉️ XCM]" -%}
{%- else -%}
{%- set xcm = "" -%}
{%- endif -%}

{{- repo }} {{ audit }}[`#{{c.number}}`]({{c.html_url}}) {{- prio }} - {{ c.title | capitalize | truncate(length=120, end="…") }}{{xcm }}
{%- endmacro change -%}
2 changes: 2 additions & 0 deletions scripts/ci/changelog/templates/changes.md.tera
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@

{% include "changes_runtime.md.tera" %}

{% include "changes_api.md.tera" %}

{% include "changes_misc.md.tera" %}
19 changes: 19 additions & 0 deletions scripts/ci/changelog/templates/changes_api.md.tera
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% import "change.md.tera" as m_c -%}
### API

{#- The changes are sorted by merge date #}
{%- for pr in changes | sort(attribute="merged_at") %}

{%- if pr.meta.B %}
{%- if pr.meta.B.value == 0 %}
{#- We skip silent ones -#}
{%- else -%}

{%- if pr.meta.T and pr.meta.T.value == 2 and not pr.title is containing("ompanion") %}
- {{ m_c::change(c=pr) }}
{%- else %}
<!-- EXCLUDED PR#{{pr.number}} - {{pr.html_url}} -->
{%- endif -%}
{% endif -%}
{% endif -%}
{% endfor %}
2 changes: 2 additions & 0 deletions scripts/ci/changelog/templates/changes_client.md.tera
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

{%- if pr.meta.T and pr.meta.T.value == 0 and not pr.title is containing("ompanion") %}
- {{ m_c::change(c=pr) }}
{%- else %}
<!-- EXCLUDED PR#{{pr.number}} - {{pr.html_url}} -->
{%- endif -%}
{% endif -%}
{% endif -%}
Expand Down
7 changes: 5 additions & 2 deletions scripts/ci/changelog/templates/changes_misc.md.tera
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
{%- if pr.meta.B.value == 0 -%}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.T and pr.meta.T.value == 0 %}
{%- if pr.meta.T and pr.meta.T.value > 2 %}
{%- set_global misc_count = misc_count + 1 -%}
{%- endif -%}
{% endif -%}
{% endif -%}
{% endfor -%}

<!-- Found {{ misc_count }} misc PRs -->
{%- if misc_count > 0 %}
### Misc

{% if misc_count > 10 %}
Expand All @@ -27,7 +29,7 @@ There are other misc. changes. You can expand the list below to view them all.
{%- if pr.meta.B.value == 0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.T and pr.meta.T.value == 0 %}
{%- if pr.meta.T and pr.meta.T.value > 2 %}
- {{ m_c::change(c=pr) }}
{%- endif -%}
{% endif -%}
Expand All @@ -37,3 +39,4 @@ There are other misc. changes. You can expand the list below to view them all.
{% if misc_count > 10 %}
</details>
{% endif -%}
{% endif -%}
2 changes: 2 additions & 0 deletions scripts/ci/changelog/templates/changes_runtime.md.tera
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

{%- if pr.meta.T and pr.meta.T.value == 1 and not pr.title is containing("ompanion") %}
- {{ m_c::change(c=pr) }}
{%- else %}
<!-- EXCLUDED PR#{{pr.number}} - {{pr.html_url}} -->
{%- endif -%}
{%- endif -%}

Expand Down

0 comments on commit 2a9ed40

Please sign in to comment.