Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Last active November 25, 2019 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jcoyne/9b53c18967a2393505912a957ed7bff2 to your computer and use it in GitHub Desktop.
Save jcoyne/9b53c18967a2393505912a957ed7bff2 to your computer and use it in GitHub Desktop.
Grab GitHub PR URLs for weekly dependency updates
// Forked from https://gist.githubusercontent.com/camillevilla/16b53c50eccc11de0cb40ee0be7dcf03/raw/51f2473d5b04bb72e835ac9168381d87c0961d31/github-pr-urls.js
// 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://github.com/sul-dlss/access-update-scripts/blob/master/infrastructure/ruby
var repoList= "argo common-accessioning dlme dlme-transform dor-services-app dor_indexing_app dor-fetcher-service gis-robot-suite google-books hydra_etd hydrus lyberservices-scripts modsulator-app-rails preservation_catalog preservation_robots pre-assembly repository-api rialto-etl rialto-webapp robot-console sul_pub sdr-services-app was-registrar-app was_robot_suite was-thumbnail-service workflow-server-rails"
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