Skip to content

Commit ea50fff

Browse files
committed
Fix output mapping
1 parent d160cb5 commit ea50fff

File tree

8 files changed

+26
-11
lines changed

8 files changed

+26
-11
lines changed

action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ outputs:
7373
description: "Indicates whether there was a change since the last version if change_path was specified. If no change_path was specified this value will always be true since the entire repo is considered."
7474
authors:
7575
description: "List of users contributing commits to this version"
76+
previous_commit:
77+
description: "Hash of the previous commit"
78+
previous_version:
79+
description: "Indicates the previous version"
80+
current_commit:
81+
description: "The current commit hash"
82+
7683
runs:
7784
using: "node16"
7885
main: "dist/index.js"

dist/index.js

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/VersionResult.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class VersionResult {
1616
* @param authors - Authors formatted according to the format mode (e.g. JSON, CSV, YAML, etc.)
1717
* @param currentCommit - The current commit hash
1818
* @param previousCommit - The previous commit hash
19-
* @param previousVersion - the previous version
19+
* @param previousVersion - The previous version
2020
*/
2121
constructor(major, minor, patch, increment, versionType, formattedVersion, versionTag, changed, authors, currentCommit, previousCommit, previousVersion) {
2222
this.major = major;

lib/formatting/DefaultTagFormatter.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@ class DefaultTagFormatter {
4343
}
4444
;
4545
IsValid(tag) {
46+
const regexEscape = (literal) => literal.replace(/\W/g, '\\$&');
47+
const tagPrefix = regexEscape(this.tagPrefix);
48+
const namespaceSeperator = regexEscape(this.namespaceSeperator);
49+
const namespace = regexEscape(this.namespace);
4650
if (!!this.namespace) {
47-
return new RegExp(`^${this.tagPrefix}[0-9]+.[0-9]+.[0-9]+${this.namespaceSeperator}${this.namespace}$`).test(tag);
51+
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+${namespaceSeperator}${namespace}$`).test(tag);
4852
}
49-
return new RegExp(`^${this.tagPrefix}[0-9]+.[0-9]+.[0-9]+$`).test(tag);
53+
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+$`).test(tag);
5054
}
5155
}
5256
exports.DefaultTagFormatter = DefaultTagFormatter;

lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ function setOutput(versionResult) {
5656
core.setOutput("changed", changed.toString());
5757
core.setOutput("version_tag", versionTag);
5858
core.setOutput("authors", authors);
59-
core.setOutput("lastVersion", authors);
6059
core.setOutput("previous_commit", previousCommit);
6160
core.setOutput("previous_version", previousVersion);
61+
core.setOutput("current_commit", currentCommit);
6262
}
6363
function run() {
6464
return __awaiter(this, void 0, void 0, function* () {

src/VersionResult.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class VersionResult {
1616
* @param authors - Authors formatted according to the format mode (e.g. JSON, CSV, YAML, etc.)
1717
* @param currentCommit - The current commit hash
1818
* @param previousCommit - The previous commit hash
19-
* @param previousVersion - the previous version
19+
* @param previousVersion - The previous version
2020
*/
2121
constructor(
2222
public major: number,

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ function setOutput(versionResult: VersionResult) {
2828
core.setOutput("changed", changed.toString());
2929
core.setOutput("version_tag", versionTag);
3030
core.setOutput("authors", authors);
31-
core.setOutput("lastVersion", authors);
3231
core.setOutput("previous_commit", previousCommit);
3332
core.setOutput("previous_version", previousVersion);
33+
core.setOutput("current_commit", currentCommit);
3434
}
3535

3636
export async function run() {

0 commit comments

Comments
 (0)