diff --git a/changelog.njk b/changelog.njk index 121ed50..95fbd00 100644 --- a/changelog.njk +++ b/changelog.njk @@ -181,10 +181,14 @@ function changelogApp() { if (!r.ok) break; const commits = await r.json(); if (!Array.isArray(commits) || commits.length === 0) break; + const sinceDate = since ? new Date(since) : null; + let pastCutoff = false; for (const c of commits) { const lines = (c.commit?.message || '').split('\n'); const title = lines[0]; const body = lines.slice(1).join('\n').trim(); + const date = c.created || c.commit?.author?.date; + if (sinceDate && new Date(date) < sinceDate) { pastCutoff = true; continue; } allCommits.push({ sha: c.sha.slice(0, 7), fullSha: c.sha, @@ -193,12 +197,12 @@ function changelogApp() { url: c.html_url, repoUrl: `${GITEA_URL}/${GITEA_ORG}/${repo}`, repoName: repo, - date: c.created || c.commit?.author?.date, + date, author: c.commit?.author?.name || '', commitCategory: categorizeCommit(title), }); } - if (commits.length < limit) break; + if (commits.length < limit || pastCutoff) break; page++; } }));