protected async Task <CheckRun> SubmitCheckRun(Annotation[] annotations, string owner, string name, string headSha, string checkRunName, string checkRunTitle, string checkRunSummary, DateTimeOffset startedAt, DateTimeOffset completedAt) { var annotationBatches = annotations?.Batch(50).ToArray(); var isFailure = annotations?.Any(annotation => annotation.CheckWarningLevel == CheckWarningLevel.Failure) ?? false; var isSuccess = !isFailure; var checkRun = await _gitHubAppModelService.CreateCheckRunAsync(owner, name, headSha, checkRunName, checkRunTitle, checkRunSummary, isSuccess, annotationBatches?.FirstOrDefault()?.ToArray(), startedAt, completedAt) .ConfigureAwait(false); foreach (var annotationBatch in annotationBatches.Skip(1)) { await _gitHubAppModelService.UpdateCheckRunAsync(checkRun.Id, owner, name, headSha, checkRunTitle, checkRunSummary, annotationBatch.ToArray(), startedAt, completedAt).ConfigureAwait(false); } return(checkRun); }
protected async Task <CheckRun> SubmitCheckRun(Annotation[] annotations, string owner, string name, string headSha, string checkRunName, string checkRunTitle, string checkRunSummary, DateTimeOffset startedAt, DateTimeOffset completedAt, bool success) { var annotationBatches = annotations?.Batch(50).ToArray(); var checkRun = await _gitHubAppModelService.CreateCheckRunAsync(owner, name, headSha, checkRunName, checkRunTitle, checkRunSummary, success, annotationBatches?.FirstOrDefault()?.ToArray(), startedAt, completedAt) .ConfigureAwait(false); if (annotationBatches != null) { foreach (var annotationBatch in annotationBatches.Skip(1)) { await _gitHubAppModelService.UpdateCheckRunAsync(checkRun.Id, owner, name, headSha, checkRunTitle, checkRunSummary, annotationBatch.ToArray(), startedAt, completedAt).ConfigureAwait(false); } } return(checkRun); }