Github Workflow 运行日志快速查看

免去一步一步点击查看运行日志

// ==UserScript==
// @name         Github Workflow 运行日志快速查看
// @namespace    http://tampermonkey.net/
// @version      0.2.5
// @description  免去一步一步点击查看运行日志
// @author       You
// @match        https://github.com/*/actions/runs/*
// @match        https://github.com/*/runs/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    var url = window.location.href;
    if (url.indexOf('actions/runs') != -1) {
        document.querySelector(".filter-list > li:nth-child(3) > a").click();
    } else if (url.indexOf('check_suite_focus') != -1) {
        var span = document.querySelectorAll("span");
        for (var i = 0; i < span.length; i++) {
            if (span[i].innerText.indexOf('Cache node_modules') != -1) {
                var run = span[i].closest('details').nextElementSibling.firstElementChild;
                run.click();
                setTimeout(function () {
                    run.scrollIntoView();
                }, 1500);
                break;
            }
        }
    }

})();