Skip to content

Commit d8f06aa

Browse files
committed
docs: update tips and tricks
Signed-off-by: Shingo OKAWA <[email protected]>
1 parent b249bf9 commit d8f06aa

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

website/docs/tips-and-tricks.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ pandoc --from=gfm --to=pdf --pdf-engine=xelatex -o CHANGELOG.pdf CHANGELOG.md --
105105

106106
## Use release statistics in your template
107107

108+
You can access various release-related metrics via the `statistics` variable. The following fields are available:
109+
110+
- `commit_count`: Total number of commits in the release.
111+
- `commits_timespan`: Number of days between the first and last commit.
112+
- `conventional_commit_count`: Number of commits that follow the Conventional Commits spec.
113+
- `links`: A list of issues or links referenced in commit messages, each with text, href, and count.
114+
- `days_passed_since_last_release`: Days since the previous release, if available.
115+
116+
You can use these fields in your templates like so:
117+
108118
```jinja2
109119
* {{ statistics.commit_count }} commit(s) contributed to the release.
110120
{%- if statistics.commits_timespan is defined %}
@@ -121,3 +131,18 @@ pandoc --from=gfm --to=pdf --pdf-engine=xelatex -o CHANGELOG.pdf CHANGELOG.md --
121131
* {{ statistics.days_passed_since_last_release }} day(s) passed between releases.
122132
{%- endif %}
123133
```
134+
135+
This results in the following output:
136+
137+
<details>
138+
<summary>Rendered Output</summary>
139+
140+
### Commit Statistics
141+
142+
* 2 commit(s) contributed to the release.
143+
* 0 day(s) passed between the first and last commit.
144+
* 2 commit(s) were parsed as conventional.
145+
* 0 issue(s) like '(#ID)' were seen in commit messages.
146+
* 1426 day(s) passed between releases.
147+
148+
</details>

0 commit comments

Comments
 (0)