diff --git a/Directory.Build.props b/Directory.Build.props index 9ac5d6c2..f6813da5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,7 +7,7 @@ - 3.6.141 + 3.6.143 all diff --git a/global.json b/global.json index 41336fb9..31836933 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.401", - "rollForward": "latestFeature" + "rollForward": "latestFeature", + "version": "8.0.401" } } \ No newline at end of file diff --git a/src/RepoM.Plugin.AzureDevOps/Internal/AzureDevOpsPullRequestService.cs b/src/RepoM.Plugin.AzureDevOps/Internal/AzureDevOpsPullRequestService.cs index 009677de..a1cc2168 100644 --- a/src/RepoM.Plugin.AzureDevOps/Internal/AzureDevOpsPullRequestService.cs +++ b/src/RepoM.Plugin.AzureDevOps/Internal/AzureDevOpsPullRequestService.cs @@ -42,12 +42,21 @@ public AzureDevOpsPullRequestService(IAzureDevopsConfiguration configuration, IL try { - _connection = new VssConnection( - _configuration.AzureDevOpsBaseUrl, - new VssBasicCredential(string.Empty, _configuration.AzureDevOpsPersonalAccessToken)); - _httpClient.BaseAddress = _configuration.AzureDevOpsBaseUrl; - _httpClient.DefaultRequestHeaders.Accept.Add(new("application/json")); - _httpClient.DefaultRequestHeaders.Authorization = new("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes($":{_configuration.AzureDevOpsPersonalAccessToken}"))); + if (string.IsNullOrEmpty(configuration.AzureDevOpsPersonalAccessToken)) + { + //throw new ArgumentNullException(nameof(configuration.AzureDevOpsPersonalAccessToken)); + _logger.LogInformation("No Azure configuration present"); + } + else + { + _connection = new VssConnection( + _configuration.AzureDevOpsBaseUrl, + new VssBasicCredential(string.Empty, _configuration.AzureDevOpsPersonalAccessToken)); + _httpClient.BaseAddress = _configuration.AzureDevOpsBaseUrl; + _httpClient.DefaultRequestHeaders.Accept.Add(new("application/json")); + _httpClient.DefaultRequestHeaders.Authorization = new("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes($":{_configuration.AzureDevOpsPersonalAccessToken}"))); + } + } catch (Exception e) { @@ -515,4 +524,4 @@ private static string GetRepositorySearchUrl(IRepository repository) var searchRepoUrl = url.Scheme + "://" + url.Host + url.LocalPath; return searchRepoUrl; } -} \ No newline at end of file +}