Skip to content

Instantly share code, notes, and snippets.

@kpittman-securus
Last active May 11, 2021 17:45
Show Gist options
  • Save kpittman-securus/580ee7160205cac52ed78ab5723c92ea to your computer and use it in GitHub Desktop.
Save kpittman-securus/580ee7160205cac52ed78ab5723c92ea to your computer and use it in GitHub Desktop.
With Jenkins/GitHub integration, open all failed PRs in Jenkins (from the GitHub pull requests page)
let pipe = (...funcs) => (...args) => funcs.reduce((prev, cur) => cur(prev), ...args);
let getAllPrs = () => Array.from(document.querySelectorAll('div[id^=issue]'));
let getPrNumber = (el) => el.querySelector('input[type=checkbox]').value;
let getFailedPrs = () => getAllPrs().filter((el) => el.querySelector('a.color-text-danger'));
let makeJenkinsUrl = (pr) =>
`https://jenkins-example.com/job/PR-${pr}/lastBuild/`;
let open = (url) => window.open(url);
let openPr = pipe(getPrNumber, makeJenkinsUrl, open);
let openFailedPrs = () => getFailedPrs().map(openPr);
openFailedPrs();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment