From c3811d3318b2c1e885924c3990eb62b1f15f8e75 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 27 Mar 2025 13:33:23 +0100 Subject: [PATCH] fix: refs #8715 update changelog verification in Jenkinsfile to compare with TARGET_BRANCH --- Jenkinsfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b03f8d84e..a587c5c82 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,15 +77,19 @@ pipeline { } stage('Changelog') { when { - expression { !IS_PROTECTED_BRANCH } + expression { !PROTECTED_BRANCH } } steps { script { - def changeLog = currentBuild.changeSets.collectMany { it.items.collect { it.affectedFiles.collect { it.path } }.flatten() }.flatten() - def hasChangelogChanges = changeLog.any { it == 'CHANGELOG.md' } + def diffOutput = sh( + script: "git fetch origin ${TARGET_BRANCH} && git diff --name-only origin/${TARGET_BRANCH}", + returnStdout: true + ).trim().split('\n') + echo "DIFF: ${diffOutput}" + def hasChangelog = diffOutput.any { it == 'CHANGELOG.md' } - if (!hasChangelogChanges) { - error "No se han detectado cambios en CHANGELOG.md" + if (!hasChangelog) { + error "❌ No se han detectado cambios en CHANGELOG.md respecto a ${TARGET_BRANCH}" } } }