diff --git a/tools/identity-resolution/identity-resolution.csproj b/tools/identity-resolution/identity-resolution.csproj index 38abe26aacd..2e7dfc2b3b4 100644 --- a/tools/identity-resolution/identity-resolution.csproj +++ b/tools/identity-resolution/identity-resolution.csproj @@ -8,7 +8,6 @@ - diff --git a/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/GitHubService.cs b/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/GitHubService.cs deleted file mode 100644 index c12ca0c75da..00000000000 --- a/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/GitHubService.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Threading.Tasks; -using Azure.Sdk.Tools.CodeOwnersParser; -using Microsoft.Extensions.Logging; - -namespace Azure.Sdk.Tools.PipelineOwnersExtractor -{ - /// - /// Interface for interacting with GitHub - /// - public class GitHubService - { - private static readonly HttpClient httpClient = new HttpClient(); - - private readonly ILogger logger; - private readonly ConcurrentDictionary> codeOwnersFileCache; - - /// - /// Creates a new GitHubService - /// - /// Logger - public GitHubService(ILogger logger) - { - this.logger = logger; - this.codeOwnersFileCache = new ConcurrentDictionary>(); - } - - /// - /// Looks for CODEOWNERS in the main branch of the given repo URL using cache - /// - /// GitHub repository URL - /// Contents fo the located CODEOWNERS file - public async Task> GetCodeOwnersFile(Uri repoUrl) - { - List result; - if (codeOwnersFileCache.TryGetValue(repoUrl.ToString(), out result)) - { - return result; - } - - result = await GetCodeownersFileImpl(repoUrl); - codeOwnersFileCache.TryAdd(repoUrl.ToString(), result); - return result; - } - - /// - /// Looks for CODEOWNERS in the main branch of the given repo URL - /// - /// - /// - private async Task> GetCodeownersFileImpl(Uri repoUrl) - { - // Gets the repo path from the URL - var relevantPathParts = repoUrl.Segments.Skip(1).Take(2); - var repoPath = string.Join("", relevantPathParts); - - var codeOwnersUrl = $"https://raw.githubusercontent.com/{repoPath}/main/.github/CODEOWNERS"; - var result = await httpClient.GetAsync(codeOwnersUrl); - if (result.IsSuccessStatusCode) - { - this.logger.LogInformation("Retrieved CODEOWNERS file URL = {0}", codeOwnersUrl); - return CodeOwnersFile.ParseContent(await result.Content.ReadAsStringAsync()); - } - - this.logger.LogWarning("Could not retrieve CODEOWNERS file URL = {0} ResponseCode = {1}", codeOwnersUrl, result.StatusCode); - return default; - } - - } -} diff --git a/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/Processor.cs b/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/Processor.cs index 4a928e1b59f..837a95b209e 100644 --- a/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/Processor.cs +++ b/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/Processor.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Azure.Sdk.Tools.CodeOwnersParser; +using Azure.Sdk.Tools.NotificationConfiguration; using Azure.Sdk.Tools.NotificationConfiguration.Helpers; using Azure.Sdk.Tools.NotificationConfiguration.Services; using Azure.Sdk.Tools.PipelineOwnersExtractor.Configuration; @@ -136,7 +137,7 @@ private async Task>> GetCodeOwnerEntries .Select(SanitizeRepositoryUrl) .Select(async url => ( RepositoryUrl: url, - CodeOwners: await this.gitHubService.GetCodeOwnersFile(new Uri(url)) + CodeOwners: await this.gitHubService.GetCodeownersFile(new Uri(url)) )); var taskResults = await Task.WhenAll(tasks); diff --git a/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/Program.cs b/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/Program.cs index 07cc6c3f4de..dd3f20c0037 100644 --- a/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/Program.cs +++ b/tools/pipeline-owners-extractor/Azure.Sdk.Tools.PipelineOwnersExtractor/Program.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.Sdk.Tools.NotificationConfiguration; using Azure.Sdk.Tools.NotificationConfiguration.Helpers; using Azure.Sdk.Tools.NotificationConfiguration.Services; using Azure.Sdk.Tools.PipelineOwnersExtractor.Configuration;