From f393800a92e7a0e6e7e98901b7de62856c870f4e Mon Sep 17 00:00:00 2001 From: Nicholas Felt Date: Tue, 24 Oct 2023 15:34:31 -0700 Subject: [PATCH] ci: Update macro to enable GitHub Release template to function properly. (#68) * ci: Update macro to enable GitHub Release template to function properly. * ci: Fix whitespace that is generated by the templates. Signed-off-by: v12ganesh ganesh.v@tektronix.com --- CHANGELOG.md | 5 ++++- pyproject.toml | 2 +- python_semantic_release_templates/.macros.j2 | 4 ++-- python_semantic_release_templates/.release_notes.md.j2 | 4 ++-- python_semantic_release_templates/CHANGELOG.md.j2 | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 516ecbb4..be6e7814 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ ______________________________________________________________________ Things to be included in the next release go here. +### Fixed + +- Fixed the GitHub Release template generation + ______________________________________________________________________ ## v0.1.20 (2023-10-24) @@ -258,4 +262,3 @@ ______________________________________________________________________ ### Added - First release of `tm_devices`! - \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8989d995..d6b14088 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -374,7 +374,7 @@ exclude_commit_patterns = [] template_dir = "python_semantic_release_templates" [tool.semantic_release.changelog.environment] -extensions = ["jinja2.ext.do"] +extensions = [] [tool.semantic_release.commit_parser_options] # These settings allow python-semantic-release to be used without triggering on any commits diff --git a/python_semantic_release_templates/.macros.j2 b/python_semantic_release_templates/.macros.j2 index 1034a917..be277d6c 100644 --- a/python_semantic_release_templates/.macros.j2 +++ b/python_semantic_release_templates/.macros.j2 @@ -7,7 +7,7 @@ {%- for commit in commits %} {%- set pr_num = commit.commit.message.rstrip().rsplit("(#", 1)[-1].rsplit(")", 1)[0]|int %} {%- if pr_num %} - {%- do recently_merged_prs.update({commit.commit.message.split("\n")[0].rsplit("(#", 1)[0]|safe: pr_num}) %} + {{- recently_merged_prs.update({commit.commit.message.split("\n")[0].rsplit("(#", 1)[0]|safe: pr_num})|replace("None", "") }} {%- endif %} {%- endfor %} {%- endfor %} @@ -15,7 +15,7 @@ {%- if recently_merged_prs %} {%- set merged_prs_text_list = ["\n\n### Merged Pull Requests\n\n"] %} {%- for message, number in recently_merged_prs.items() %} - {%- do merged_prs_text_list.append("- " ~ message ~ "([#" + number|string ~ "](" ~ number|string|pull_request_url ~ "))\n") %} + {{- merged_prs_text_list.append("- " ~ message ~ "([#" + number|string ~ "](" ~ number|string|pull_request_url ~ "))\n")|replace("None", "") }} {%- endfor %} {%- set merged_prs_text = (merged_prs_text_list|join).rstrip() %} {%- else %} diff --git a/python_semantic_release_templates/.release_notes.md.j2 b/python_semantic_release_templates/.release_notes.md.j2 index d92964a5..86b17467 100644 --- a/python_semantic_release_templates/.release_notes.md.j2 +++ b/python_semantic_release_templates/.release_notes.md.j2 @@ -3,5 +3,5 @@ {%- call(output) macros.populate_variables() %} {%- filter replace("Things to be included in the next release go here.", "# " + output[0] + " (" + output[1] + ")" + output[2])|replace("##", "#") %} {%- include ".previous_release_notes_for_template.md" %} - {% endfilter %} -{%- endcall %} + {%- endfilter %} +{% endcall %} diff --git a/python_semantic_release_templates/CHANGELOG.md.j2 b/python_semantic_release_templates/CHANGELOG.md.j2 index 81c96ba8..b03c4bb9 100644 --- a/python_semantic_release_templates/CHANGELOG.md.j2 +++ b/python_semantic_release_templates/CHANGELOG.md.j2 @@ -3,5 +3,5 @@ {%- call(output) macros.populate_variables() %} {%- filter replace("Things to be included in the next release go here.", "Things to be included in the next release go here.\n\n______________________________________________________________________\n\n## " + output[0] + " (" + output[1] + ")" + output[2]) %} {%- include ".previous_changelog_for_template.md" %} - {% endfilter %} -{%- endcall %} + {%- endfilter %} +{% endcall %}