diff --git a/SSW.Rules.AzFuncs/Functions/Widget/UpdateLatestRules.cs b/SSW.Rules.AzFuncs/Functions/Widget/UpdateLatestRules.cs index 9d0dfa1..b3285fd 100644 --- a/SSW.Rules.AzFuncs/Functions/Widget/UpdateLatestRules.cs +++ b/SSW.Rules.AzFuncs/Functions/Widget/UpdateLatestRules.cs @@ -36,6 +36,8 @@ public async Task Run( StartPage = 1 }; + _logger.LogInformation("Getting pull requests"); + var pullRequests = await gitHubClient.PullRequest.GetAllForRepository(repositoryOwner, repositoryName, request, apiOptions); @@ -45,17 +47,24 @@ await gitHubClient.PullRequest.GetAllForRepository(repositoryOwner, repositoryNa throw new Exception("No Pull Requests found"); } + _logger.LogInformation("Getting sync history hash"); var syncHistoryHash = await context.SyncHistory.GetAll(); var existingCommitHashes = new HashSet(syncHistoryHash.Select(sh => sh.CommitHash)); HttpClient httpClient = new HttpClient(); var newRules = new List(); var updatedCount = 0; + foreach (var pr in pullRequests) { + _logger.LogInformation($"Scanning PR {pr.Number}"); if (existingCommitHashes.Contains(pr.MergeCommitSha)) break; if (!pr.Merged) continue; - if (pr.ChangedFiles > 100) continue; // Skips big PRs as these will fail + if (pr.ChangedFiles > 100) // Skips big PRs as these will fail + { + _logger.LogInformation($"Skipping PR {pr.Number}"); + continue; + }; var files = await gitHubClient.PullRequest.Files(repositoryOwner, repositoryName, pr.Number); foreach (var file in files)