diff options
author | Matt Rendina <rendinam@users.noreply.github.com> | 2019-01-07 15:16:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-07 15:16:33 -0500 |
commit | 49b0532d241a1e8fa2a9a000e129554e8c476b6c (patch) | |
tree | 64932b30f3c8dfc376f6e1750bcebd5b95ca81a5 /vars | |
parent | 9a0d5368ad2a08e773a51340f174c06e7f6c72b0 (diff) | |
download | jscu_refactor-49b0532d241a1e8fa2a9a000e129554e8c476b6c.tar.gz |
Apply 'testing' label to notification issues if label exists in repo. (#28)1.3.0
Diffstat (limited to 'vars')
-rw-r--r-- | vars/utils.groovy | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vars/utils.groovy b/vars/utils.groovy index 849d036..ef651dc 100644 --- a/vars/utils.groovy +++ b/vars/utils.groovy @@ -14,8 +14,19 @@ import org.kohsuke.github.GitHub def postGithubIssue(reponame, username, password, subject, message) { def github = GitHub.connectUsingPassword("${username}", "${password}") def repo = github.getRepository(reponame) + // Determine if the 'testing' label exists in the repo. If it does, + // apply it to the new issue. + def labels = repo.listLabels() + def labelnames = [] + for (label in labels) { + labelnames.add(label.getName()) + } + def labelname = 'testing' def ibuilder = repo.createIssue(subject) ibuilder.body(message) + if (labelname in labelnames) { + ibuilder.label(labelname) + } ibuilder.create() } |