After more research into when a null reviewDecision can occur, I determined we can be a bit smarter about how we assign the review status.
Whenever the reviewDecision is null it means the repository has not enabled the Require pull request reviews before merging branch protection feature. Soure: https://github.com/orgs/community/discussions/24375
In this scenario any 'approving' review is sufficient to determine if the code was approved. Therefore, whenever the reviewDecision field is null, we check if any reviews have the APPROVED state, and set the reviewDecision to APPROVED if so, otherwise we set it to the default status of UNKNOWN.
After more research into when a
null
reviewDecision can occur, I determined we can be a bit smarter about how we assign the review status.Whenever the reviewDecision is
null
it means the repository has not enabled theRequire pull request reviews before merging
branch protection feature. Soure: https://github.com/orgs/community/discussions/24375In this scenario any 'approving' review is sufficient to determine if the code was approved. Therefore, whenever the
reviewDecision
field isnull
, we check if any reviews have theAPPROVED
state, and set thereviewDecision
toAPPROVED
if so, otherwise we set it to the default status ofUNKNOWN
.