Skip to content

Commit

Permalink
docs(changelog): make it possible to include a section of the commit …
Browse files Browse the repository at this point in the history
…message in the changelog

This part of the commit message will not be included.
If you have any references to issues, or need to
include the keywords to cause a major version bump,
include them before the section that should go into
the changelog.

-CHANGELOG-
This part of the commit message will be included in
the release notes and in the changelog. For optimal
formatting in the changelog, do not include blank
lines, only single line breaks.
  - Lists can be included by indenting them with 2 spaces.
    Further lines on the same list item, like this one,
    should be indented with 2 more spaces still.
  • Loading branch information
adrianschmidt committed Sep 19, 2023
1 parent e6bde5e commit 992ba86
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
34 changes: 34 additions & 0 deletions commit.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

*{{#if scope}} **{{scope}}:**
{{~/if}} {{#if subject}}
{{~subject}}
{{~else}}
{{~header}}
{{~/if}}

{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}}
([{{shortHash}}]({{~@root.host}}/{{#if this.owner}}{{~this.owner}}{{else}}{{~@root.owner}}{{/if}}/{{#if this.repository}}{{~this.repository}}{{else}}{{~@root.repository}}{{/if}}/commit/{{hash}}))
{{~else}}
{{~shortHash}}
{{~/if}}{{~/if}}

{{~!-- commit references --}}
{{~#if references~}}
, closes
{{~#each references}} {{#if @root.linkReferences~}}
[
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}{{this.prefix}}{{this.issue}}]({{~@root.host}}/{{#if this.owner}}{{~this.owner}}{{else}}{{~@root.owner}}{{/if}}/{{#if this.repository}}{{~this.repository}}{{else}}{{~@root.repository}}{{/if}}/issues/{{this.issue}})
{{~else}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}{{this.prefix}}{{this.issue}}
{{~/if}}{{/each}}
{{~/if}}
{{#if CHANGELOG}}

{{CHANGELOG}}
{{~/if}}
10 changes: 9 additions & 1 deletion release.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* eslint-env node */
const { readFileSync } = require('fs');
const { join } = require('path');

module.exports = {
branches: [
'main',
Expand All @@ -18,7 +21,12 @@ module.exports = {
[
'@semantic-release/release-notes-generator',
{
preset: 'conventionalcommits',
writerOpts: {
commitPartial: readFileSync(
join(__dirname, 'commit.hbs'),
'utf-8'
),
},
},
],
'@semantic-release/changelog',
Expand Down

0 comments on commit 992ba86

Please sign in to comment.