DO-75/add_getBranch_method (#4)

add getBranch method
This commit is contained in:
Aleksandr Vodyanov
2023-09-28 11:47:50 +00:00
parent 5a7ef065d6
commit b86e7814e4

View File

@@ -11,6 +11,17 @@ class Git implements Serializable {
this.script = script
}
* get current Branch name
* @return String - branch name
*/
public String getBranch() {
if (script.env.BRANCH_NAME.startsWith('PR')) {
return "${script.env.CHANGE_BRANCH}"
}
return "${script.env.BRANCH_NAME}"
}
/**
* Method to clone a Git repository
* @param args Map - Arguments for cloning