protected override ValidationResult PopulateSettings(SettingsContainer settings) { var baseResult = base.PopulateSettings(settings); if (!baseResult.IsSuccess) { return(baseResult); } var apiBase = GithubEndpointWithFallback(); if (string.IsNullOrWhiteSpace(apiBase)) { return(ValidationResult.Failure("No GitHub Api base found")); } if (!Uri.TryCreate(apiBase, UriKind.Absolute, out var githubUri)) { return(ValidationResult.Failure($"Bad GitHub Api base '{GithubApiEndpoint}'")); } var token = ReadToken(); if (string.IsNullOrWhiteSpace(token)) { return(ValidationResult.Failure("The required GitHub access token was not found")); } var githubUrl = GitSettingsReader.EnsureTrailingSlash(githubUri); var fileSettings = FileSettingsCache.Get(); settings.GithubAuthSettings = new GithubAuthSettings(githubUrl, token); settings.UserSettings.ConsolidateUpdatesInSinglePullRequest = Concat.FirstValue(Consolidate, fileSettings.Consolidate, false); const int defaultMaxPullRequests = 3; settings.PackageFilters.MaxPackageUpdates = Concat.FirstValue(MaxPullRequestsPerRepository, fileSettings.MaxPr, defaultMaxPullRequests); settings.UserSettings.ForkMode = ForkMode; settings.UserSettings.ReportMode = ReportMode; var defaultLabels = new[] { "nukeeper" }; settings.SourceControlServerSettings.Labels = Concat.FirstPopulatedList(Label, fileSettings.Label, defaultLabels); return(ValidationResult.Success); }
protected override ValidationResult PopulateSettings(SettingsContainer settings) { var baseResult = base.PopulateSettings(settings); if (!baseResult.IsSuccess) { return(baseResult); } if (string.IsNullOrWhiteSpace(GithubApiEndpoint)) { return(ValidationResult.Failure("No GitHub Api base found")); } Uri githubUri; if (!Uri.TryCreate(GithubApiEndpoint, UriKind.Absolute, out githubUri)) { return(ValidationResult.Failure($"Bad GitHub Api base '{GithubApiEndpoint}'")); } var token = ReadToken(); if (string.IsNullOrWhiteSpace(token)) { return(ValidationResult.Failure("The required GitHub access token was not found")); } var githubUrl = GitSettingsReader.EnsureTrailingSlash(githubUri); settings.GithubAuthSettings = new GithubAuthSettings(githubUrl, token); settings.UserSettings.MaxRepositoriesChanged = AllowedMaxRepositoriesChangedChange; settings.UserSettings.MaxPullRequestsPerRepository = MaxPullRequestsPerRepository; settings.UserSettings.ForkMode = ForkMode; settings.UserSettings.ReportMode = ReportMode; settings.ModalSettings.Labels = Label; return(ValidationResult.Success); }