Skip to content

Commit

Permalink
Remove trailing dashes (#32)
Browse files Browse the repository at this point in the history
Git allows them, but not Github
  • Loading branch information
Mojken authored Aug 12, 2022
1 parent 1d330e3 commit b1ce9b2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8443,7 +8443,8 @@ const TRANSFORMERS = {
.trim()
.replace(/\s+/g, "-")
.toLowerCase()
.replace(/[^a-z0-9-_]/g, "");
.replace(/[^a-z0-9_]/g, "")
.replace(/-+$/g, "");
return `#${number}-${name}`;
},
title: ({ title }) => title,
Expand Down
3 changes: 2 additions & 1 deletion src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ const TRANSFORMERS = {
.trim()
.replace(/\s+/g, "-")
.toLowerCase()
.replace(/[^a-z0-9-_]/g, "");
.replace(/[^a-z0-9-_]/g, "")
.replace(/-+$/g, "");
return `#${number}-${name}`;
},
title: ({ title }) => title,
Expand Down
2 changes: 1 addition & 1 deletion src/action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ test("getTagName", () => {
expect(getTagName({ title: "hejhej", number: 32 })).toBe("release/hejhej");

process.env["INPUT_TAG_TRANSFORMER"] = "dashes-and-number";
expect(getTagName({ title: "This is a PR", number: 32 })).toBe(
expect(getTagName({ title: "This is a PR---", number: 32 })).toBe(
"release/#32-this-is-a-pr"
);

Expand Down

0 comments on commit b1ce9b2

Please sign in to comment.