Skip to content

Commit

Permalink
ci: fix release notes generation (#8815)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Nov 14, 2024
1 parent 39cb1b7 commit 44e00f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
10 changes: 8 additions & 2 deletions tools/changelog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,18 @@ async function getChangeLog(repo, previousCommit, currentCommit) {

const revWalk = repo.revWalk();

let headId = repo.head().target();

if (currentCommit) {
const commit =
repo.findCommit(currentCommit) ?? findTagByName(repo, previousCommit);
repo.findCommit(currentCommit) ?? findTagByName(repo, currentCommit);
if (!commit) {
console.log(
`Current commit ${currentCommit} not found in ${repo.path()}`
);
return '';
}
headId = commit.id();
revWalk.push(commit.id());
} else {
revWalk.pushHead();
Expand All @@ -89,7 +92,7 @@ async function getChangeLog(repo, previousCommit, currentCommit) {
email: commit.author().email(),
},
});
if (commitId.startsWith(previousCommit)) {
if (commitId === prevCommit.id()) {
break;
}
}
Expand All @@ -98,6 +101,9 @@ async function getChangeLog(repo, previousCommit, currentCommit) {
token: process.env.GITHUB_TOKEN,
});

parseConfig.from = prevCommit.id();
parseConfig.to = headId;

const parsedCommits = parseCommits(commits, parseConfig);
await resolveAuthors(parsedCommits, parseConfig);
return generateMarkdown(parsedCommits, parseConfig)
Expand Down
4 changes: 2 additions & 2 deletions tools/changelog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"dependencies": {
"@napi-rs/simple-git": "^0.1.18",
"@slack/web-api": "^7.3.4",
"changelogithub": "^0.13.9",
"jsx-slack": "^6.1.1",
"changelogithub": "^0.13.11",
"jsx-slack": "^6.1.2",
"marked": "^15.0.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ __metadata:
"@napi-rs/simple-git": "npm:^0.1.18"
"@slack/web-api": "npm:^7.3.4"
"@types/node": "npm:^20.14.12"
changelogithub: "npm:^0.13.9"
jsx-slack: "npm:^6.1.1"
changelogithub: "npm:^0.13.11"
jsx-slack: "npm:^6.1.2"
marked: "npm:^15.0.0"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -16659,7 +16659,7 @@ __metadata:
languageName: node
linkType: hard

"changelogithub@npm:^0.13.9":
"changelogithub@npm:^0.13.11":
version: 0.13.11
resolution: "changelogithub@npm:0.13.11"
dependencies:
Expand Down Expand Up @@ -23598,7 +23598,7 @@ __metadata:
languageName: node
linkType: hard

"jsx-slack@npm:^6.1.1":
"jsx-slack@npm:^6.1.1, jsx-slack@npm:^6.1.2":
version: 6.1.2
resolution: "jsx-slack@npm:6.1.2"
dependencies:
Expand Down

0 comments on commit 44e00f6

Please sign in to comment.