Hi all,
This has been a real struggle to get done but with help from this community and others I’ve done it and wanted to share (plus ask for alternative/better methods).
Goal: Make creating release notes a less manual task
Environment: JIRA Cloud for day to day development workflow, Monday for housing release notes (among loads of other uses).
Constraints: JIRA not available to whole business (license costs) but Monday is.
Summary:
There is a JIRA integration but it didn’t quite do what i wanted. So, I set up a Post Function from JIRA that ran a ScriptRunner script (JIRA add on) to fire a Create_Item mutation, with Column_Values, on a particular board then updated that item using Create Update to add the JIRA ticket description as an pulse update (as i prefer this to adding a large amount of text to a column field).
Here’s my ScriptRunner script so someone else might find it useful:
import groovy.json.JsonSlurper
def apiToken = '<YOUR API TOKEN HERE>'
def slurper = new JsonSlurper()
def issueKey = issue.key
def issueSummary = issue.fields.summary
def issueType = issue.fields.issuetype
def issueDescription = issue.fields.description
def todaysDate = new Date().format( 'yyyy-MM-dd' )
def jiraURL = "<YOUR JIRA URL HERE>"
def msg1 = [
query : 'mutation{create_item (board_id: <TARGET BOARD>,group_id:"<TARGET GROUP>",item_name: "' + issueSummary + '"' +
',column_values:"{'+
'\\\"text1\\\":\\\"'+issueKey+'\\\"'+
',\\\"link\\\":{\\\"url\\\":\\\"'+ jiraURL + issueKey +'\\\",\\\"text\\\":\\\"'+issueKey+'\\\"}'+
',\\\"date\\\":{\\\"date\\\":\\\"'+todaysDate+'\\\"}'+
'}") {id}}'
]
HttpResponse<String> jsonResp = post('https://api.monday.com/v2')
.header('Content-Type', 'application/json')
.header('Authorization', "${apiToken}")
.body(msg1)
.asString()
def result = slurper.parseText(jsonResp.body)
Integer iid = result["data"]["create_item"]["id"] as Integer
def msg2 = [
query : 'mutation{create_update (item_id: '+iid+', body: "'+issueDescription+'") {id}}'
]
post('https://api.monday.com/v2')
.header('Content-Type', 'application/json')
.header('Authorization', "${apiToken}")
.body(msg2)
.asString()
So now, when a ticket moves into the appropriate state, a monday pulse is created with the core data and the description field in the JIRA ticket gets added.
I’m sure we will change this to make improvements but at the moment i’m just pleased it’s working!
I hope someone else finds this useful and if there’s any questions then i can go into more detail about the JIRA part. Or, if anyone has ideas to improve it then i’ll gladly take those too
Cheers
Simon