From a73600a18d5447fd7608e860e1b6fed5bd8ed0b7 Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Mon, 18 Aug 2025 19:47:06 +0100 Subject: [PATCH 1/2] fix(changelog-check): improve devDependencies section detection in git diffs --- src/changelog-check.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/changelog-check.ts b/src/changelog-check.ts index 10f69320..628dafd5 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -140,10 +140,7 @@ const getDevDependencyLines = ( } } - if ( - devDependencySectionStart === undefined || - devDependencySectionEnd === undefined - ) { + if (devDependencySectionStart === undefined) { return []; } @@ -151,10 +148,12 @@ const getDevDependencyLines = ( for (const changeLine of nonVersionLines) { const lineIndex = allLines.findIndex((line) => line === changeLine); if (lineIndex !== -1) { - // Check if this line falls within any devDependencies section + // Check if this line falls within the devDependencies section + // If we don't have an end, assume everything after start is in devDependencies const isInDevDeps = lineIndex >= devDependencySectionStart && - lineIndex <= devDependencySectionEnd; + (devDependencySectionEnd === undefined || + lineIndex <= devDependencySectionEnd); if (isInDevDeps) { devDependencyLines.push(changeLine); From 39fafddb003916d0fe4dc5810c6401510cb852d2 Mon Sep 17 00:00:00 2001 From: Salah-Eddine Saakoun Date: Wed, 5 Nov 2025 15:59:38 +0100 Subject: [PATCH 2/2] fix: use maximum context to ensure section headers are visible --- src/changelog-check.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/changelog-check.ts b/src/changelog-check.ts index 628dafd5..c9285ccc 100644 --- a/src/changelog-check.ts +++ b/src/changelog-check.ts @@ -140,7 +140,10 @@ const getDevDependencyLines = ( } } - if (devDependencySectionStart === undefined) { + if ( + devDependencySectionStart === undefined || + devDependencySectionEnd === undefined + ) { return []; } @@ -148,12 +151,10 @@ const getDevDependencyLines = ( for (const changeLine of nonVersionLines) { const lineIndex = allLines.findIndex((line) => line === changeLine); if (lineIndex !== -1) { - // Check if this line falls within the devDependencies section - // If we don't have an end, assume everything after start is in devDependencies + // Check if this line falls within any devDependencies section const isInDevDeps = lineIndex >= devDependencySectionStart && - (devDependencySectionEnd === undefined || - lineIndex <= devDependencySectionEnd); + lineIndex <= devDependencySectionEnd; if (isInDevDeps) { devDependencyLines.push(changeLine); @@ -201,7 +202,13 @@ async function analyzePackageJsonChanges( try { const { stdout } = await execa( 'git', - ['diff', '-U20', `origin/${baseRef}...HEAD`, '--', filePath], + [ + 'diff', + '-U9999', // Show maximum context to ensure section headers are visible + `origin/${baseRef}...HEAD`, + '--', + filePath, + ], { cwd: repoPath, },