diff --git a/Jenkinsfile b/Jenkinsfile index 5e1ef59..e9d2293 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,16 +22,11 @@ pipeline { sh 'git submodule update --init --recursive' - def branch = sh( - script: "git branch --show-current", - returnStdout: true - ).trim() - - if(branch != 'main') { - echo "[!] Not on 'main' branch. Current branch: ${branch}" + if (env.BRANCH_NAME !== 'main') { + echo "[!] Not on main branch. Stopping pipeline." currentBuild.result = 'SUCCESS' error("Stopping pipeline: not on main branch.") - } + } def tagName = sh( script: "git describe --tags --exact-match 2>/dev/null || echo 'no-tag'", diff --git a/README.md b/README.md index 6903ca8..708f216 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # dotnet.worker - \ No newline at end of file + \ No newline at end of file