Skip to content

Instantly share code, notes, and snippets.

@aburd
Created October 21, 2021 07:34
Show Gist options
  • Save aburd/81d86e612937077d96b44c62a05b6048 to your computer and use it in GitHub Desktop.
Save aburd/81d86e612937077d96b44c62a05b6048 to your computer and use it in GitHub Desktop.
Get a report from a github issue
function daysUntilClosed() {
const hSel = "#partial-discussion-header relative-time"
const hSelEl = document.querySelector(hSel)
const d1 = new Date(hSelEl.title)
const hSel2 = "relative-time"
const hSelEls = document.querySelectorAll(hSel2)
const hSelEl2 = hSelEls[hSelEls.length - 1]
const d2 = new Date(hSelEl2.title)
const ms = d1 - d2
return ms / 1000 / 60 / 60 / 24
}
function getAuthors() {
const authors = [...document.querySelectorAll('.author')].map(e => e.innerText).filter(t => t !== "zeals-co-ltd");
const s = new Set(authors)
return [...s.values()].join(', ')
}
function getMerged() {
return Boolean(document.querySelector('.State--merged'))
}
function report() {
console.log(`Days: ${daysUntilClosed()}`)
console.log(`Authors: ${getAuthors()}`)
console.log(`Merged: ${getMerged()}`)
}
report()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment