Skip to content

Instantly share code, notes, and snippets.

@smellymonk
Last active March 26, 2021 00:31
Show Gist options
  • Save smellymonk/697d3157cfea78ee552c114ac6fe044b to your computer and use it in GitHub Desktop.
Save smellymonk/697d3157cfea78ee552c114ac6fe044b to your computer and use it in GitHub Desktop.
Get Jira Sprint Ticket Descriptions
var issues = $('.ghx-issues')[0]
var getData = (issues, selectors) => {
return selectors.map(([sel, name, getter]) => {
return Array.from(issues.querySelectorAll(sel)).map(item => ({
[name]: getter ? item[getter] : item.innerText
}))
}).reduce((items, next) => items.map((item, j) => ({...item, ...next[j]})))
}
var result = getData(issues, [['.ghx-summary', 'title'], ['.ghx-key', 'ticket'], ['.ghx-type', 'type', 'title']])
var list = result
.filter(({title}) => !title.startsWith('SPIKE'))
.map(({title, ticket, type}) => `${ticket} (${type}): ${title}`)
var text = list.join('\n')
copy(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment