Skip to content

Commit 00b828d

Browse files
authored
Merge pull request #367 from Expensify/nicolas-checkrun-status-fixes
Ignore peer review check and show pending status for running checks
2 parents b9851ef + 5f1da42 commit 00b828d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/js/lib/actions/PullRequests.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import * as API from '../api';
44
import ONYXKEYS from '../../ONYXKEYS';
55
import ActionThrottle from '../ActionThrottle';
66

7+
// Check runs whose results should not affect the overall check conclusion shown for a PR.
8+
// "Check independent approval" (from the "Verify peer review" workflow) fails until a peer
9+
// review happens, which is not a CI failure the author needs to act on.
10+
const IGNORED_CHECK_RUN_NAMES = ['Check independent approval'];
11+
712
function getChecks(prs, onyxKey) {
813
const checkRunPromises = _.reduce(prs, (finalPromiseArray, pr) => {
914
finalPromiseArray.push(
@@ -16,13 +21,23 @@ function getChecks(prs, onyxKey) {
1621
checkConclusion: _.reduce(
1722
response.data.check_runs,
1823
(previousValue, currentValue) => {
24+
if (_.contains(IGNORED_CHECK_RUN_NAMES, currentValue.name)) {
25+
return previousValue;
26+
}
27+
1928
const conclusion = currentValue.conclusion;
2029

2130
// If any check runs are failing, mark it failed
2231
if (conclusion === 'failure' || previousValue === 'failure') {
2332
return 'failure';
2433
}
2534

35+
// Check runs only get a conclusion once they complete, so any run that isn't
36+
// completed yet means the overall result is still pending
37+
if (currentValue.status !== 'completed' || previousValue === 'pending') {
38+
return 'pending';
39+
}
40+
2641
// If the current check run is successful, mark it success. If the previous one is
2742
// successful, this one could only be successful or skipped, and either way, we
2843
// want to mark the whole thing as successful

0 commit comments

Comments
 (0)