fix: bump blocksuite script changelog generate failed (#8708)

This commit is contained in:
donteatfriedrice 2024-11-05 10:44:27 +00:00
parent 01228117e3
commit c0d802a169
No known key found for this signature in database
GPG Key ID: 710A67A6AC71FD16

View File

@ -25,6 +25,8 @@ const info = await fetch('https://registry.npmjs.org/@blocksuite/affine').then(
const latestVersion = info['dist-tags'].latest; const latestVersion = info['dist-tags'].latest;
const latestHash = latestVersion.split('-').pop(); const latestHash = latestVersion.split('-').pop();
const latestGitHead = info.versions[latestHash].gitHead;
const oldGitHead = info.versions[oldHash].gitHead;
if (oldHash === latestHash) { if (oldHash === latestHash) {
console.info(chalk.greenBright('Already updated')); console.info(chalk.greenBright('Already updated'));
@ -85,8 +87,6 @@ remote.fetch(
) )
); );
const latest = repo.findCommit(latestHash);
const commits = { const commits = {
Features: [], Features: [],
Bugfix: [], Bugfix: [],
@ -94,11 +94,17 @@ const commits = {
Misc: [], Misc: [],
}; };
if (!latestGitHead) {
console.info('latestGitHead is not found');
console.info('Skip generating changelog');
process.exit(0);
}
for (const oid of repo for (const oid of repo
.revWalk() .revWalk()
.push(latest.id()) .push(latestGitHead)
.setSorting(Sort.Time & Sort.Topological)) { .setSorting(Sort.Time & Sort.Topological)) {
if (oid.startsWith(oldHash)) { if (oid.startsWith(oldGitHead)) {
break; break;
} }
const commit = repo.findCommit(oid); const commit = repo.findCommit(oid);