Skip to content

Commit 4d5bc0e

Browse files
committed
feat: add messageHeadline
1 parent f38f3e2 commit 4d5bc0e

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- uses: actions/checkout@v2
29-
- uses: Klemensas/action-autotag@stable
29+
- uses: Klemensas/action-autotag@latest
3030
with:
3131
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
3232
```
@@ -37,7 +37,7 @@ This **order** is important!
3737
3838
```yaml
3939
- uses: actions/checkout@v2
40-
- uses: Klemensas/action-autotag@stable
40+
- uses: Klemensas/action-autotag@latest
4141
```
4242
4343
> If the repository is not checked out first, the autotagger cannot find the package.json file.
@@ -47,7 +47,7 @@ This **order** is important!
4747
The `GITHUB_TOKEN` must be passed in. Without this, it is not possible to create a new tag. Make sure the autotag action looks like the following example:
4848

4949
```yaml
50-
- uses: Klemensas/action-autotag@stable
50+
- uses: Klemensas/action-autotag@latest
5151
with:
5252
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
5353
```
@@ -63,7 +63,7 @@ There are several options to customize how the tag is created.
6363
By default, autotag will look for the `package.json` file in the project root. If the file is located in a subdirectory, this option can be used to point to the correct file.
6464

6565
```yaml
66-
- uses: Klemensas/action-autotag@stable
66+
- uses: Klemensas/action-autotag@latest
6767
with:
6868
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
6969
package_root: "/path/to/subdirectory"
@@ -74,7 +74,7 @@ There are several options to customize how the tag is created.
7474
By default, `package.json` uses [semantic versioning](https://semver.org/), such as `1.0.0`. A prefix can be used to add text before the tag name. For example, if `tag_prefix` is set to `v`, then the tag would be labeled as `v1.0.0`.
7575

7676
```yaml
77-
- uses: Klemensas/action-autotag@stable
77+
- uses: Klemensas/action-autotag@latest
7878
with:
7979
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
8080
tag_prefix: "v"
@@ -85,7 +85,7 @@ There are several options to customize how the tag is created.
8585
Text can also be applied to the end of the tag by setting `tag_suffix`. For example, if `tag_suffix` is ` (beta)`, the tag would be `1.0.0 (beta)`. Please note this example violates semantic versioning and is merely here to illustrate how to add text to the end of a tag name if you _really_ want to.
8686

8787
```yaml
88-
- uses: Klemensas/action-autotag@stable
88+
- uses: Klemensas/action-autotag@latest
8989
with:
9090
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
9191
tag_suffix: " (beta)"
@@ -97,19 +97,32 @@ There are several options to customize how the tag is created.
9797
changelog will be generated from the commits between the latest tag and the new tag (HEAD). Setting this option will override it witha custom message.
9898

9999
```yaml
100-
- uses: Klemensas/action-autotag@stable
100+
- uses: Klemensas/action-autotag@latest
101101
with:
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@latest
113+
with:
114+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
115+
changelog_structure: "**{{messageHeadline}}** {{author}}\n"
116+
```
117+
105118

106119
1. `version`
107120

108121
Explicitly set the version instead of automatically detecting from `package.json`.
109122
Useful for non-JavaScript projects where version may be output by a previous action.
110123

111124
```yaml
112-
- uses: Klemensas/action-autotag@stable
125+
- uses: Klemensas/action-autotag@latest
113126
with:
114127
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
115128
version: "${{ steps.previous_step.outputs.version }}"

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)