Skip to content

Commit

Permalink
[Fix] not all commits have checks on them
Browse files Browse the repository at this point in the history
  • Loading branch information
Green-Ranger11 committed Mar 14, 2022
1 parent 89021b3 commit 0b8b138
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions utils/evaluateChecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ function parseCheckRuns(statusCheckRollup, requiredChecks) {
module.exports = function evaluateChecks(pullRequest, requiredChecks) {
const { commits: { nodes: [{ commit: { statusCheckRollup } }] } } = pullRequest;

for (const ctx of statusCheckRollup.contexts.nodes) {
/* eslint no-underscore-dangle: 0 */
if (ctx.__typename === 'StatusContext' && ctx.state !== 'SUCCESS') {
return parseStatusChecks(statusCheckRollup, requiredChecks);
}
if (ctx.__typename === 'CheckRun' && ctx.conclusion !== 'SUCCESS') {
return parseCheckRuns(statusCheckRollup, requiredChecks);
if (statusCheckRollup?.context?.nodes) {
for (const ctx of statusCheckRollup.contexts.nodes) {
/* eslint no-underscore-dangle: 0 */
if (ctx.__typename === 'StatusContext' && ctx.state !== 'SUCCESS') {
return parseStatusChecks(statusCheckRollup, requiredChecks);
}
if (ctx.__typename === 'CheckRun' && ctx.conclusion !== 'SUCCESS') {
return parseCheckRuns(statusCheckRollup, requiredChecks);
}
}
}

Expand Down

0 comments on commit 0b8b138

Please sign in to comment.