Skip to content

Commit

Permalink
Merge pull request #41 from capthiron/fix/null-check-for-commit-status
Browse files Browse the repository at this point in the history
fix(check-status): add null check for commit status rollup
  • Loading branch information
GrantBirki committed Nov 1, 2023
2 parents 3dcd81a + 4e299dc commit efe4892
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/functions/check-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ export async function checkStatus(
// Check for CI status
if (mustBeGreen) {
const [{commit}] = result.repository.pullRequest.commits.nodes
const state = commit.statusCheckRollup.state
core.info('Validating status: ' + state)
if (state !== 'SUCCESS') {
core.info('Discarding ' + branch + ' with status ' + state)
if (commit.statusCheckRollup) {
const state = commit.statusCheckRollup.state
core.info('Validating status: ' + state)
if (state !== 'SUCCESS') {
core.info('Discarding ' + branch + ' with status ' + state)
statusOK = false
}
} else {
core.info('No status check associated with branch: ' + branch)
statusOK = false
}
}
Expand Down

0 comments on commit efe4892

Please sign in to comment.