Skip to content

Commit 1ca4dc4

Browse files
docs: explain format commit template
1 parent 2fe4ae4 commit 1ca4dc4

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,43 @@ The changelog generator will order the types of commits in the changelog in the
2121
- Build
2222
- CI
2323

24-
## Emoji changelogs
24+
## Emoji Changelogs
2525

2626
In order to use emoji changelogs including a prefixed emoji, you need to provide the following config when calling semantic-relase: `--changelog-generator-opt "emojis=true"`. Or add the config within your `.semrelrc` file.
2727

2828
[Example Change Log](./examples/GENERATED_CHANGELOG.md)
2929

30+
31+
## Format Commit Template
32+
33+
The plugin allows to specify the template which is used to render commits with the `--changelog-generator-opt` CLI flag, e.g., `--changelog-generator-opt "format_commit_template={{.Message}}"`. Or by adding the `format_commit_template` option within your `.semrelrc` file.
34+
35+
36+
The following variables are available:
37+
38+
| Variable | Description |
39+
|--------------|-----------------------------------------------------------------------------------------|
40+
| .SHA | The commit SHA (e.g., c862ecee7682be648289579b515dbc03a5357c89). |
41+
| .Type | The type of the commit (e.g., feat, fix, chore, etc). |
42+
| .Scope | The scope of the commit. |
43+
| .Message | The first line of the commit message. |
44+
| .Raw | The raw commit message as a string array representing each line of the commit. |
45+
| .Annotations | A map containing different commit annotations like the `author_name` or `author_email`. |
46+
47+
Additionally, the following functions are available:
48+
49+
| Function | Description |
50+
|----------|-------------------------------------------------|
51+
| trimSHA | Trims the SHA to the its first eight characters |
52+
53+
### Examples:
54+
55+
| Template | Example Output |
56+
|------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
57+
| `* {{with .Scope -}} **{{.}}:** {{end}} {{- .Message}} ({{trimSHA .SHA}})` | `* **app:** commit message (12345678)` |
58+
| `* {{with .Scope -}} **{{.}}:** {{end}} {{- .Message}} ({{trimSHA .SHA}}) {{- with index .Annotations "author_login" }} - by @{{.}} {{- end}}` | `* **app:** commit message (12345678) - by @commit-author` |
59+
60+
3061
## Licence
3162

3263
The [MIT License (MIT)](http://opensource.org/licenses/MIT)

0 commit comments

Comments
 (0)