diff --git a/Jenkinsfile b/Jenkinsfile index 8d5fac5..703d948 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -91,10 +91,16 @@ def commitChanges() { // Check for changes sh """ + git status git pull origin ${env.BRANCH_NAME} - git add . - git commit -m "Moved processed XML files to backup" - git push --force https://jenkinstest:Bizgaze123@code.bizgaze.com/devops.bizgaze/imports.git ${env.BRANCH_NAME} + # Only proceed if there are changes + if [[ $(git status -s) ]]; then + git add . + git commit -m "Moved processed XML files to backup" + git push https://jenkinstest:Bizgaze123@code.bizgaze.com/devops.bizgaze/imports.git ${env.BRANCH_NAME} + else + echo "No changes to commit." + fi """ }