Skip to content

Commit

Permalink
[CI] Ping assignees on Github PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brianseeders committed Feb 18, 2021
1 parent 543bf1b commit 65c2064
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions vars/githubPr.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ def getNextCommentMessage(previousCommentInfo = [:], isFinal = false) {

messages << "To update your PR or re-run it, just comment with:\n`@elasticmachine merge upstream`"

def assignees = getAssignees()
if (assignees) {
messages << "cc " + assignees.collect { "@${it}"}.join(" ")
}

info.builds << [
status: status,
url: env.BUILD_URL,
Expand Down Expand Up @@ -329,3 +334,19 @@ def shouldCheckCiMetricSuccess() {

return true
}

def getPR() {
withGithubCredentials {
def path = "repos/elastic/kibana/pulls/${env.ghprbPullId}"
return githubApi.get(path)
}
}

def getAssignees() {
def pr = getPR()
if (!pr) {
return []
}

return pr.assignees.collect { it.login }
}

0 comments on commit 65c2064

Please sign in to comment.