Skip to content

Commit 65494cf

Browse files
committed
feat: add messageHeadline
1 parent f38f3e2 commit 65494cf

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,19 @@ There are several options to customize how the tag is created.
102102
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
103103
tag_message: "Custom message goes here."
104104
```
105+
1. `changelog_structure`
106+
107+
Provide a custom changelog format when not using `tag_message`.
108+
This can interpolate strings, supported strings are `{{message}}`, `{{messageHeadline}}`, `{{author}}` and `{{sha}}`.
109+
Defaults to `**1) {{message}}** {{author}}\n(SHA: {{sha}})\n`.
110+
111+
```yaml
112+
- uses: Klemensas/action-autotag@stable
113+
with:
114+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
115+
changelog_structure: "**{{messageHeadline}}** {{author}}\n"
116+
```
117+
105118

106119
1. `version`
107120

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ inputs:
1919
description: This is the annotated commit message associated with the tag. By default, a changelog will be generated from the commits between the latest tag and the new tag (HEAD). This will override that with a hard-coded message.
2020
required: false
2121
changelog_structure:
22-
description: "A string denoting changelog format. Supports `{{message}}`, `{{author}}` and `{{sha}}`. Defaults to `**1) {{message}}** {{author}}\n(SHA: {{sha}})\n` Only used when tag_message is empty."
22+
description: "A string denoting changelog format. Supports `{{message}}`, {{messageHeadline}}, `{{author}}` and `{{sha}}`. Defaults to `**1) {{message}}** {{author}}\n(SHA: {{sha}})\n` Only used when tag_message is empty."
2323
required: false
2424
version:
2525
description: Explicitly set the version here instead of automatically detecting from `package.json`. Useful for non-JavaScript projects where version may be output by a previous action.

lib/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ async function run() {
100100
.map(
101101
commit =>
102102
structure
103-
.replace(/({{message}})|({{author}})|({{sha}})/g, (match, message, author, sha) => {
103+
.replace(/({{message}})|{{messageHeadline}})|({{author}})|({{sha}})/g, (match, message, messageHeadline, author, sha) => {
104104
if (message) return commit.commit.message
105+
if (messageHeadline) return commit.commit.messageHeadline
105106
if (author) return !commit.hasOwnProperty('author') || !commit.author.hasOwnProperty('login') ? '' : commit.author.login
106107
if (sha) return commit.sha
107108
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "autotag-action",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"private": true,
55
"description": "Automatically create a tag whenever the version changes in package.json",
66
"main": "lib/main.js",

0 commit comments

Comments
 (0)