Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Log to debug #53

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion SSW.Rules.AzFuncs/Functions/Widget/UpdateLatestRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public async Task<HttpResponseData> Run(
StartPage = 1
};

_logger.LogInformation("Getting pull requests");

var pullRequests =
await gitHubClient.PullRequest.GetAllForRepository(repositoryOwner, repositoryName, request,
apiOptions);
Expand All @@ -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<string>(syncHistoryHash.Select(sh => sh.CommitHash));
HttpClient httpClient = new HttpClient();
var newRules = new List<LatestRules>();
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)
Expand Down
Loading