Skip to content

Commit d07a4a7

Browse files
authored
feat: Add release-id output (#101)
1 parent 2600f00 commit d07a4a7

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Automatic Changelog generator
1919
- [Outputs](#outputs)
2020
- [Changelog](#changelog)
2121
- [Pre-release](#prerelease)
22+
- [Release ID](#release-id)
2223
- [Example Usage](#example-usage)
2324

2425
## Usage
@@ -180,6 +181,12 @@ Indicates whether it's a pre-release or not.
180181

181182
> if semver is set to `true`, otherwise this output will always return `false`.
182183

184+
#### `release-id`
185+
186+
The pre-release id in case of prerelease being `true`, `latest` otherwise. (e.g. `alpha`, `beta`, `rc`, `canary`)
187+
188+
> if semver is set to `true`, otherwise this output will always return `latest`.
189+
183190
### Example Usage
184191

185192
Using with default inputs:

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ outputs:
7272
prerelease:
7373
description: Indicates whether it's a pre-release or not (if semver is set to true, otherwise this output will always return false)
7474

75+
release-id:
76+
description: The pre-release id in case of prerelease being true, latest otherwise (if semver is set to true, otherwise this output will always return latest)
77+
7578
runs:
7679
using: node16
7780
main: action/index.js

action/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

action/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ async function run(): Promise<void> {
3030
}
3131

3232
let prerelease = false;
33+
let releaseId = "latest";
3334

34-
if (semver != null) prerelease = semver.prerelease.length > 0;
35+
if (semver != null) {
36+
prerelease = semver.prerelease.length > 0;
37+
releaseId = semver.prerelease[0] as string;
38+
}
3539

3640
const { sha: tagRef, name: tagName } = await getTagSha({
3741
octokit,
@@ -74,6 +78,10 @@ async function run(): Promise<void> {
7478

7579
setOutput("prerelease", prerelease);
7680

81+
info(`-> release-id: ${ releaseId }`);
82+
83+
setOutput("release-id", releaseId);
84+
7785
info(`-> changelog: "${ changelog }"`);
7886

7987
setOutput("changelog", changelog);

0 commit comments

Comments
 (0)