From bbdc60dd42f74291e73b226a1d03ef75d9fc33f2 Mon Sep 17 00:00:00 2001 From: Ronnie Lazar Date: Tue, 6 Jul 2021 12:53:29 +0300 Subject: [PATCH] Fixed issue when there are no PR checks --- github_list_own_prs_in_repo.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github_list_own_prs_in_repo.js b/github_list_own_prs_in_repo.js index 6b08e46..1ffe446 100644 --- a/github_list_own_prs_in_repo.js +++ b/github_list_own_prs_in_repo.js @@ -3,7 +3,7 @@ // @description A brief description of your script // @namespace http://arantius.com/misc/greasemonkey/ // @author Sagi Dayan -// @match https://github.com/* +// @match https://github.com/* // @version 1.0 // ==/UserScript== @@ -50,7 +50,7 @@ setInterval(() => { function createPrHTML(pr) { const div = document.createElement('div'); - const prState = pr.commits.nodes[0].commit.statusCheckRollup.state; + const prState = pr.commits.nodes[0].commit.statusCheckRollup?.state || ''; const prStateColor = prState === 'FAILURE' ? 'red' : (prState === 'SUCCESS' ? 'green' : 'yellow'); div.className = "d-sm-flex Box mb-2 Box-body color-bg-secondary"; @@ -69,4 +69,4 @@ function createPrHTML(pr) { `; return div; -} \ No newline at end of file +}