Skip to content

Instantly share code, notes, and snippets.

@artem-hatchenko
Last active February 6, 2023 16:56
Show Gist options
  • Save artem-hatchenko/c517c9771ca9b84aebc97b364cb60d0e to your computer and use it in GitHub Desktop.
Save artem-hatchenko/c517c9771ca9b84aebc97b364cb60d0e to your computer and use it in GitHub Desktop.
stage("Send notification") {
steps {
script {
withCredentials([string(credentialsId: 'slack-app', variable: 'slack_token')]) {
env.SLACK_USER_ID = sh (script: """
SLACK_USER_ID="\$(curl -d \"token=${slack_token}\" -d \"email=${env.AUTHOR_EMAIL}\" https://slack.com/api/users.lookupByEmail | jq -r '.user.id')"
echo \$SLACK_USER_ID""", returnStdout: true).trim()
}
if ("${env.PULL_REQUEST_COMMENT_COUNT}" == "0") {
sendBitbucketComment ("${env.REPO_FULL_NAME}", "${env.PULL_REQUEST_ID}", "${env.WELCOME_COMMENT}")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment