check database for existing changelogs before importing releases

This commit is contained in:
2026-03-21 22:47:21 +02:00
parent a8eb6ba03e
commit 1008044491

View File

@@ -182,13 +182,25 @@ async function syncRepos(ctx) {
const releaseKey = `${repo.fullName}:${release.id}`;
if (imported.has(releaseKey)) continue;
const title = `${titleCase(repo.name)} ${release.name}`;
// check if this changelog already exists in the database
const exists = await ctx.prisma.changelogEntry.findFirst({
where: { title, boardId: board.id },
select: { id: true },
});
if (exists) {
imported.add(releaseKey);
continue;
}
const body = release.body
? `${release.body}\n\n[View release](${release.htmlUrl})`
: `[View release](${release.htmlUrl})`;
await ctx.prisma.changelogEntry.create({
data: {
title: `${titleCase(repo.name)} ${release.name}`,
title,
body,
boardId: board.id,
publishedAt: new Date(release.publishedAt),