Last active
March 22, 2018 22:45
-
-
Save GLips/05b2bfcd6093c4ef4aef777b512d8868 to your computer and use it in GitHub Desktop.
Use Scriptrunner for JIRA Cloud to add the project's lead as a watcher
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 issueKey = issue.key | |
def projectKey = issue.fields.project.key | |
def projectLead = get("/rest/api/2/project/${projectKey}").asObject(Map).body['lead']['key'] | |
logger.info("Project lead: ${projectLead}") | |
// Docs for this endpoint: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-issue-issueIdOrKey-watchers-post | |
def result = post("/rest/api/2/issue/${issueKey}/watchers") | |
.header('Content-Type', 'application/json') | |
.body("\"${projectLead}\"") | |
.asString() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment