Skip to content

Commit 4c5d29c

Browse files
committed
feat: Add tag name view options
1 parent 23ca3c8 commit 4c5d29c

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ jobs:
7474
shell: bash
7575
- name: Get notes
7676
id: generate_notes
77-
uses: mckrava/standard-version-release-notes@master
77+
uses: mckrava/standard-version-release-notes@v1.1.0
7878
with:
7979
tag_name: ${{ github.ref }}
80+
tag_name_ref_view: true
8081
changelog: CHANGELOG.md
8182
- name: Create Release
8283
id: create_release
@@ -93,13 +94,15 @@ jobs:
9394
9495
## Input Variables
9596
96-
| Name | Description | Default |
97-
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
98-
| `tag_name` | Name of the tag whose release notes we are looking for | - |
99-
| `changelog` | Path to changelog file | - |
97+
| Name | Description | Default |
98+
| ------------------- | ------------------------------------------------------ | ------- |
99+
| `tag_name` | Name of the tag whose release notes we are looking for | - |
100+
| `changelog` | Path to changelog file | - |
101+
| `tag_name_prefix` | Tag name prefix | "v" |
102+
| `tag_name_ref_view` | Does tag name have such view as `refs/tags/{tag_name}` | false |
100103

101104
## Output Variables
102105

103-
| Name | Description | Default |
104-
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
105-
| `notes` | Serialized dictionary as string containing the `notes` key which hosts the list of lines that hold data for the aforementioned tag | - |
106+
| Name | Description | Default |
107+
| ------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------- |
108+
| `notes` | Serialized dictionary as string containing the `notes` key which hosts the list of lines that hold data for the aforementioned tag | - |

action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@ name: 'Get Release Notes from standard-version changelog'
22
description: 'Get release notes for Changelog from standatd-version'
33
inputs:
44
tag_name:
5-
description: "Name of the tag whose release notes we are looking for (must have structure 'refs/tags/{tag_name}')"
5+
description: "Name of the tag whose release notes we are looking for (can have structure either 'refs/tags/{tag_name}' or 'tag_name')"
66
required: true
77
changelog:
88
description: "Path to changelog file to be parsed"
99
required: true
10+
tag_name_prefix:
11+
description: "Tag name prefix"
12+
required: false
13+
default: "v"
14+
tag_name_ref_view:
15+
description: "Tag name 'refs' structure or exact tag name ('refs/tags/vX.X.X' or 'vX.X.X')"
16+
required: false
17+
default: "false"
1018
outputs:
1119
notes:
1220
description: "The serialized dict of the notes. Access the notes from the notes key of the dict"

main.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33
import re
44

55

6-
TAG_NAME = os.getenv("INPUT_TAG_NAME").split("refs/tags/")[1]
6+
TAG_NAME = os.getenv("INPUT_TAG_NAME")
7+
TAG_NAME_PREFIX = os.getenv("INPUT_TAG_NAME_PREFIX")
8+
TAG_NAME_REF_VIEW = os.getenv("INPUT_TAG_NAME_REF_VIEW")
79
PATH_TO_CHANGELOG = os.getenv("INPUT_CHANGELOG")
810

11+
if TAG_NAME_REF_VIEW == "true":
12+
TAG_NAME = TAG_NAME.split("refs/tags/")[1]
13+
14+
# We need remove prefix because changelog contains version headers without prefix
15+
if TAG_NAME_PREFIX != '':
16+
TAG_NAME = TAG_NAME.replace(TAG_NAME_PREFIX, '', 1)
17+
918

1019
def get_changelog_lines():
1120
"""

0 commit comments

Comments
 (0)