Skip to content

Instantly share code, notes, and snippets.

@camillevilla
Last active September 17, 2018 17:47
Show Gist options
  • Save camillevilla/16b53c50eccc11de0cb40ee0be7dcf03 to your computer and use it in GitHub Desktop.
Save camillevilla/16b53c50eccc11de0cb40ee0be7dcf03 to your computer and use it in GitHub Desktop.
Grab GitHub PR URLs for weekly dependency updates
// v2.1
// even bettah! Links with sort order retained + links to "Files changed"
// PR search at https://github.com/pulls
// is:pr org:sul-dlss head:update-dependencies created:2018-05-08..2018-05-09
// Repo order used in our update script and status table
// https://gist.github.com/cbeer/efefe04222dfb27bfbe5cad2076e2e83
var repoList= "purl stacks sul-embed purl-fetcher content_search course_reserves discovery-dispatcher earthworks exhibits library_hours_rails sul-bento-app sul-directory sul-requests sw-indexer SearchWorks revs dlme arclight-demo vatican_exhibits revs-indexer-service bassi_veratti editstore-updater mods_display_app mirador_sul frda relevancy_dashboard stanford-arclight searchworks-status"
repoList = repoList.split(' ')
// Retreive PR links
var elements = Array.from(document.getElementsByClassName('js-navigation-open'))
var links = []
links = elements.filter(element => element.text.search("dependencies") > 0)
links = links.map((link) => link.href + '/files')
// Make a hash of repo name : PR link pairs
var pairs = {}
links.forEach((value) => {
pairs[value.split('/')[4]] = value
})
// Compose a copy n' paste-able table of repo names with either PR links OR empty cells
var prettyTable = []
repoList.forEach((repo) => {if (pairs[repo]){
prettyTable.push(`${repo}\t${pairs[repo]}`)
} else {
prettyTable.push(`${repo}\t `)
}})
// join with new lines
prettyTable.join('\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment