Skip to content

Commit

Permalink
Merge pull request #17 from brainelectronics/feature/add-meta-data-as…
Browse files Browse the repository at this point in the history
…-comment

Add meta data as comment
  • Loading branch information
brainelectronics authored Oct 4, 2024
2 parents 2b93c08 + 37a58ad commit 8db6d98
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# snippets2changelog specific
changelog.md.new

# changelog2version specific
changelog.json

# custom, package specific ignores
.DS_Store
.DS_Store?
Expand Down
9 changes: 9 additions & 0 deletions .snippets/16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Add comment with meta data below every changelog entry
<!--
type: feature
scope: all
affected: all
-->

- add comment with meta data below every changelog entry for later parsing, closes #16
- update `README` badge to show support for Python 3.9 - 3.11 instead of generic Python 3
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Downloads](https://pepy.tech/badge/snippets2changelog)](https://pepy.tech/project/snippets2changelog)
![Release](https://img.shields.io/github/v/release/brainelectronics/snippets2changelog?include_prereleases&color=success)
![Python](https://img.shields.io/badge/python3-Ok-green.svg)
![Python](https://img.shields.io/badge/Python-3.9%20|%203.10%20|%203.11-green.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![codecov](https://codecov.io/github/brainelectronics/snippets2changelog/branch/main/graph/badge.svg)](https://app.codecov.io/github/brainelectronics/snippets2changelog)

Expand Down
5 changes: 5 additions & 0 deletions snippets2changelog/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ def update_changelog(self) -> None:
changelog_entry_content = {
"version": self.semver_data,
"timestamp": commit.committed_datetime.isoformat(),
"meta": {
"type": snippet_content["type"],
"scope": snippet_content["scope"],
"affected": snippet_content["affected"],
},
"content": snippet_content["details"],
"version_reference": f"https://github.com/brainelectronics/snippets2changelog/tree/{self.semver_data}",
}
Expand Down
3 changes: 3 additions & 0 deletions snippets2changelog/templates/changelog_part.md.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## [{{ version }}] - {{ timestamp }}
{%- if meta %}
<!-- meta = {{ meta }} -->
{%- endif %}
{{- content }}
[{{ version }}]: {{ version_reference }}

0 comments on commit 8db6d98

Please sign in to comment.