ci: fix release notes generation (#8815)

This commit is contained in:
Brooooooklyn 2024-11-14 07:13:02 +00:00
parent 39cb1b7714
commit 44e00f67c4
No known key found for this signature in database
GPG Key ID: 30B1140CE1C07C99
3 changed files with 14 additions and 8 deletions

View File

@ -64,15 +64,18 @@ async function getChangeLog(repo, previousCommit, currentCommit) {
const revWalk = repo.revWalk(); const revWalk = repo.revWalk();
let headId = repo.head().target();
if (currentCommit) { if (currentCommit) {
const commit = const commit =
repo.findCommit(currentCommit) ?? findTagByName(repo, previousCommit); repo.findCommit(currentCommit) ?? findTagByName(repo, currentCommit);
if (!commit) { if (!commit) {
console.log( console.log(
`Current commit ${currentCommit} not found in ${repo.path()}` `Current commit ${currentCommit} not found in ${repo.path()}`
); );
return ''; return '';
} }
headId = commit.id();
revWalk.push(commit.id()); revWalk.push(commit.id());
} else { } else {
revWalk.pushHead(); revWalk.pushHead();
@ -89,7 +92,7 @@ async function getChangeLog(repo, previousCommit, currentCommit) {
email: commit.author().email(), email: commit.author().email(),
}, },
}); });
if (commitId.startsWith(previousCommit)) { if (commitId === prevCommit.id()) {
break; break;
} }
} }
@ -98,6 +101,9 @@ async function getChangeLog(repo, previousCommit, currentCommit) {
token: process.env.GITHUB_TOKEN, token: process.env.GITHUB_TOKEN,
}); });
parseConfig.from = prevCommit.id();
parseConfig.to = headId;
const parsedCommits = parseCommits(commits, parseConfig); const parsedCommits = parseCommits(commits, parseConfig);
await resolveAuthors(parsedCommits, parseConfig); await resolveAuthors(parsedCommits, parseConfig);
return generateMarkdown(parsedCommits, parseConfig) return generateMarkdown(parsedCommits, parseConfig)

View File

@ -8,8 +8,8 @@
"dependencies": { "dependencies": {
"@napi-rs/simple-git": "^0.1.18", "@napi-rs/simple-git": "^0.1.18",
"@slack/web-api": "^7.3.4", "@slack/web-api": "^7.3.4",
"changelogithub": "^0.13.9", "changelogithub": "^0.13.11",
"jsx-slack": "^6.1.1", "jsx-slack": "^6.1.2",
"marked": "^15.0.0" "marked": "^15.0.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -256,8 +256,8 @@ __metadata:
"@napi-rs/simple-git": "npm:^0.1.18" "@napi-rs/simple-git": "npm:^0.1.18"
"@slack/web-api": "npm:^7.3.4" "@slack/web-api": "npm:^7.3.4"
"@types/node": "npm:^20.14.12" "@types/node": "npm:^20.14.12"
changelogithub: "npm:^0.13.9" changelogithub: "npm:^0.13.11"
jsx-slack: "npm:^6.1.1" jsx-slack: "npm:^6.1.2"
marked: "npm:^15.0.0" marked: "npm:^15.0.0"
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@ -16659,7 +16659,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"changelogithub@npm:^0.13.9": "changelogithub@npm:^0.13.11":
version: 0.13.11 version: 0.13.11
resolution: "changelogithub@npm:0.13.11" resolution: "changelogithub@npm:0.13.11"
dependencies: dependencies:
@ -23598,7 +23598,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"jsx-slack@npm:^6.1.1": "jsx-slack@npm:^6.1.1, jsx-slack@npm:^6.1.2":
version: 6.1.2 version: 6.1.2
resolution: "jsx-slack@npm:6.1.2" resolution: "jsx-slack@npm:6.1.2"
dependencies: dependencies: