Skip to content

Commit

Permalink
ci: Update macro to enable GitHub Release template to function proper…
Browse files Browse the repository at this point in the history
…ly. (tektronix#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 [email protected]
  • Loading branch information
nfelt14 authored Oct 24, 2023
1 parent c0d262f commit f393800
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -258,4 +262,3 @@ ______________________________________________________________________
### Added

- First release of `tm_devices`!

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions python_semantic_release_templates/.macros.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
{%- 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 %}

{%- 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 %}
Expand Down
4 changes: 2 additions & 2 deletions python_semantic_release_templates/.release_notes.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
4 changes: 2 additions & 2 deletions python_semantic_release_templates/CHANGELOG.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

0 comments on commit f393800

Please sign in to comment.