fix: refs #8715 update changelog verification in Jenkinsfile to compare with TARGET_BRANCH
gitea/salix-front/pipeline/pr-dev Something is wrong with the build of this commit Details

This commit is contained in:
Alex Moreno 2025-03-27 13:33:23 +01:00
parent a32a95b088
commit c3811d3318
1 changed files with 9 additions and 5 deletions

14
Jenkinsfile vendored
View File

@ -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}"
}
}
}