diff --git a/app_dart/lib/src/request_handlers/push_gold_status_to_github.dart b/app_dart/lib/src/request_handlers/push_gold_status_to_github.dart index 9a12349b5..44eac3e1b 100644 --- a/app_dart/lib/src/request_handlers/push_gold_status_to_github.dart +++ b/app_dart/lib/src/request_handlers/push_gold_status_to_github.dart @@ -136,7 +136,6 @@ final class PushGoldStatusToGithub extends ApiRequestHandler { checkRuns = checkRuns ?? >[]; log.debug('This PR has ${checkRuns.length} checks.'); for (var checkRun in checkRuns) { - log.debug('Check run: $checkRun'); final name = checkRun['name'].toLowerCase() as String; if (slug == Config.flutterSlug) { if (const [ @@ -160,8 +159,13 @@ final class PushGoldStatusToGithub extends ApiRequestHandler { runsGoldenFileTests = true; } } - if (checkRun['conclusion'] == null || - checkRun['conclusion'].toUpperCase() != 'SUCCESS') { + const successfulConclusion = {'SUCCESS', 'NEUTRAL'}; + + if (checkRun['status']?.toUpperCase() != 'COMPLETED' || + !successfulConclusion.contains( + checkRun['conclusion']?.toUpperCase(), + )) { + log.debug('Incomplete check run: $checkRun'); incompleteChecks.add(name); } } diff --git a/app_dart/test/request_handlers/push_gold_status_to_github_test.dart b/app_dart/test/request_handlers/push_gold_status_to_github_test.dart index 097fc6407..9af33c416 100644 --- a/app_dart/test/request_handlers/push_gold_status_to_github_test.dart +++ b/app_dart/test/request_handlers/push_gold_status_to_github_test.dart @@ -361,6 +361,64 @@ void main() { ); }); + test( + 'same commit, neutral checks complete, last status complete', + () async { + // Same commit + final pr = newPullRequest(123, 'abc', 'master'); + prsFromGitHub = [pr]; + + firestore.putDocument( + newGithubGoldStatus( + slug, + pr, + GithubGoldStatus.statusCompleted, + 'abc', + config.flutterGoldSuccessValue!, + ), + ); + + // Neutral checks complete + checkRuns = [ + { + 'name': 'framework', + 'status': 'completed', + 'conclusion': 'neutral', + }, + { + 'name': 'web engine', + 'status': 'completed', + 'conclusion': 'neutral', + }, + ]; + + final body = await tester.get(handler); + expect(body, same(Response.emptyOk)); + expect( + firestore, + existsInStorage(fs.GithubGoldStatus.metadata, [ + isGithubGoldStatus.hasUpdates(0), + ]), + ); + expect(log, hasNoWarningsOrHigher); + + // Should not apply labels or make comments + verifyNever( + issuesService.addLabelsToIssue(slug, pr.number!, [ + kGoldenFileLabel, + ]), + ); + + verifyNever( + issuesService.createComment( + slug, + pr.number!, + argThat(contains(config.flutterGoldCommentID(pr))), + ), + ); + }, + ); + test( 'same commit, checks complete, last status & gold status is running/awaiting triage, should not comment', () async { @@ -1160,7 +1218,7 @@ void main() { checkRuns = [ { 'name': 'framework', - 'completed': 'in_progress', + 'status': 'completed', 'conclusion': 'success', }, ];