aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Rendina <rendinam@users.noreply.github.com>2019-01-07 15:16:33 -0500
committerGitHub <noreply@github.com>2019-01-07 15:16:33 -0500
commit49b0532d241a1e8fa2a9a000e129554e8c476b6c (patch)
tree64932b30f3c8dfc376f6e1750bcebd5b95ca81a5
parent9a0d5368ad2a08e773a51340f174c06e7f6c72b0 (diff)
downloadjscu_refactor-49b0532d241a1e8fa2a9a000e129554e8c476b6c.tar.gz
Apply 'testing' label to notification issues if label exists in repo. (#28)1.3.0
-rw-r--r--vars/utils.groovy11
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()
}