Skip to content

Commit

Permalink
fix: patch changelogithub to find correct tag
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Apr 15, 2024
1 parent e90bb74 commit dfb8a85
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,10 @@
"typescript": "^5.4.5",
"vitest": "^1.5.0"
},
"prettier": "prettier-config-hyoban"
"prettier": "prettier-config-hyoban",
"pnpm": {
"patchedDependencies": {
"changelogithub@0.13.6": "patches/changelogithub@0.13.6.patch"
}
}
}
30 changes: 30 additions & 0 deletions patches/changelogithub@0.13.6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/dist/index.cjs b/dist/index.cjs
index 58583c81c7d53430a0fa0ec4272835d0612a9e0e..af680a98143fcb32435650df652c5e954395210b 100644
--- a/dist/index.cjs
+++ b/dist/index.cjs
@@ -144,8 +144,8 @@ async function getLastMatchingTag(inputTag) {
const tags = await getGitTags();
let tag;
if (!isPrerelease2 && isVersion)
- tag = tags.find((tag2) => tag2 !== inputTag && tag2[0] === "v" && !tag2.includes("-"));
- tag || (tag = tags.find((tag2) => tag2 !== inputTag));
+ tag = tags.find((tag2) => tag2 !== inputTag && semver__default.valid(semver__default.coerce(tag)) && semver__default.prerelease(tag) === null);
+ tag || (tag = tags.find((tag2) => tag2 !== inputTag && semver__default.valid(semver__default.coerce(tag))));
return tag;
}
async function isRefGitTag(to) {
diff --git a/dist/index.mjs b/dist/index.mjs
index 2aa6747fdfa40e0980f7cfc9480c99536e7c636b..d7587dbcbdeefb608a82b637f36adfd8feff7b68 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -138,8 +138,8 @@ async function getLastMatchingTag(inputTag) {
const tags = await getGitTags();
let tag;
if (!isPrerelease2 && isVersion)
- tag = tags.find((tag2) => tag2 !== inputTag && tag2[0] === "v" && !tag2.includes("-"));
- tag || (tag = tags.find((tag2) => tag2 !== inputTag));
+ tag = tags.find((tag2) => tag2 !== inputTag && semver.valid(semver.coerce(tag)) && semver.prerelease(tag) === null);
+ tag || (tag = tags.find((tag2) => tag2 !== inputTag && semver.valid(semver.coerce(tag))));
return tag;
}
async function isRefGitTag(to) {
10 changes: 8 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dfb8a85

Please sign in to comment.