Last active
August 21, 2020 14:25
-
-
Save dfrancolr/07df6f4a1a06e1d0e14c39e6de55c5b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def call() { | |
if (env.CHANGE_BRANCH && env.BUILD_NUMBER == "1" && env.BRANCH_NAME.contains('PR')) { | |
try { | |
withCredentials([string(credentialsId: 'jira-token', variable: 'JIRA_TOKEN')]) { | |
sh """ curl -s -X POST https://${env.JIRA_URL}/rest/api/2/issue/${env.CHANGE_BRANCH}/comment -H 'Authorization: Basic ${JIRA_TOKEN}' -H 'Content-Type: application/json' -d '{ "body": "PR - ${env.CHANGE_URL} "}' """ | |
} | |
} catch (err) { | |
println("Can't update Task on Jira") | |
} | |
} else { | |
println("Can't update Task on Jira") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment