Last active
October 25, 2022 10:17
-
-
Save vguerci/59952cc81761d2b2f6aaa2f59bf862a8 to your computer and use it in GitHub Desktop.
Bitrise better logs user script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Bitrise better logs | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0.3 | |
// @description Auto load entire log, expand steps and scroll to the first step failure, or follow if job running, or bottom | |
// @author Vincent Guerci | |
// @match https://app.bitrise.io/build/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=bitrise.io | |
// @grant none | |
// @downloadURL https://gist.github.com/vguerci/59952cc81761d2b2f6aaa2f59bf862a8/raw/bitrise-better-logs.user.js | |
// @updateURL https://gist.github.com/vguerci/59952cc81761d2b2f6aaa2f59bf862a8/raw/bitrise-better-logs.user.js | |
// ==/UserScript== | |
// Load entire log | |
window.addEventListener('load', function() { | |
var buttons = Array.from(document.querySelectorAll('button')); | |
var loadAll = buttons.find(button => button.innerText=="Load entire log"); | |
if (loadAll) loadAll.click(); | |
}); | |
// Open all steps | |
setInterval(() => { | |
var follow = document.getElementsByClassName('follow-button is-selected')[0]; | |
var buttons = Array.from(document.getElementsByClassName('step__open-button')); | |
buttons.forEach(button => button.click()) | |
}, 100); | |
// Scroll to first error / Follow / Scroll to bottom | |
setTimeout(() => { | |
var errorLogs = Array.from(document.getElementsByClassName('log-color-red')); | |
var firstError = errorLogs.find(log => log.innerText=='x'); | |
if (firstError) { | |
firstError.scrollIntoView({block: "end"}); | |
return; | |
} | |
var follow = document.getElementsByClassName('follow-button')[0]; | |
if (follow) follow.click(); | |
else window.scrollTo(0, document.body.scrollHeight); | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment