public static async Task CreatePullRequest( this IGitHub gitHub, RepositoryData repository, string title, string body, string branchWithChanges, IEnumerable <string> labels) { string qualifiedBranch; if (repository.Pull.Owner == repository.Push.Owner) { qualifiedBranch = branchWithChanges; } else { qualifiedBranch = repository.Push.Owner + ":" + branchWithChanges; } var pr = new NewPullRequest(title, qualifiedBranch, repository.DefaultBranch) { Body = body }; await gitHub.OpenPullRequest(repository.Pull, pr, labels); }
public GitHub(Repository.IRepository <Models.GitHub.Settings> settingsRepository, IGitHub <Models.GitHub.Branch> branchService, IGitHub <Models.GitHub.PullRequest> pullRequestService, IGitHub <Models.GitHub.Comment> commentService) { _settingsRepository = settingsRepository; _branchService = branchService; _pullRequestService = pullRequestService; _commentService = commentService; }
public PackageUpdater( IGitHub gitHub, IUpdateRunner localUpdater, INuKeeperLogger logger) { _gitHub = gitHub; _updateRunner = localUpdater; _logger = logger; }
public GitHubRepositoryDiscovery( IGitHub gitHub, ModalSettings settings, INuKeeperLogger logger) { _gitHub = gitHub; _settings = settings; _logger = logger; }
public InterceptionBenchmarks() { _options = new HttpClientInterceptorOptions().ThrowsOnMissingRegistration(); var builder = new HttpRequestInterceptionBuilder(); builder .Requests() .ForHttp() .ForHost("www.google.co.uk") .ForPath("search") .ForQuery("q=Just+Eat") .Responds() .WithMediaType("text/html") .WithContent(@"<!DOCTYPE html><html dir=""ltr"" lang=""en""><head><title>Just Eat</title></head></html>") .RegisterWith(_options); builder .Requests() .ForHttps() .ForHost("files.domain.com") .ForPath("setup.exe") .ForQuery(string.Empty) .Responds() .WithMediaType("application/octet-stream") .WithContent(() => new byte[] { 0, 1, 2, 3, 4 }) .RegisterWith(_options); builder .Requests() .ForHttps() .ForHost("api.github.com") .ForPath("orgs/justeat") .ForQuery(string.Empty) .Responds() .WithMediaType("application/json") .WithJsonContent(new { id = 1516790, login = "******", url = "https://api.github.com/orgs/justeat" }) .RegisterWith(_options); builder .Requests() .ForQuery("page=1") .Responds() .WithContentStream(() => File.OpenRead("organization.json")) .RegisterWith(_options); var refitSettings = new RefitSettings() { ContentSerializer = new SystemTextJsonContentSerializer(), }; #pragma warning disable CA2000 _client = _options.CreateHttpClient(); _serviceNewtonsoftJson = RestService.For <IGitHub>(_options.CreateHttpClient("https://api.github.com")); _serviceSystemTextJson = RestService.For <IGitHub>(_options.CreateHttpClient("https://api.github.com"), refitSettings); #pragma warning restore CA2000 }
public PackageUpdater( IGitHub gitHub, IUpdateRunner localUpdater, INuKeeperLogger logger, ModalSettings modalSettings) { _gitHub = gitHub; _updateRunner = localUpdater; _logger = logger; _modalSettings = modalSettings; }
public GitHubEngine( IGitHub github, IGitHubRepositoryDiscovery repositoryDiscovery, IGitHubRepositoryEngine repositoryEngine, IFolderFactory folderFactory, INuKeeperLogger logger) { _github = github; _repositoryDiscovery = repositoryDiscovery; _repositoryEngine = repositoryEngine; _folderFactory = folderFactory; _logger = logger; }
private async Task <IReadOnlyCollection <RepositorySettings> > ForAllOrgs( IGitHub gitHub, SourceControlServerSettings settings) { var allOrgs = await gitHub.GetOrganizations(); var allRepos = new List <RepositorySettings>(); foreach (var org in allOrgs) { var repos = await FromOrganisation(gitHub, org.Name ?? org.Login, settings); allRepos.AddRange(repos); } return(allRepos); }
public async Task <IEnumerable <RepositorySettings> > GetRepositories( IGitHub gitHub, SourceControlServerSettings settings) { switch (settings.Scope) { case ServerScope.Global: return(await ForAllOrgs(gitHub, settings)); case ServerScope.Organisation: return(await FromOrganisation(gitHub, settings.OrganisationName, settings)); case ServerScope.Repository: return(new[] { settings.Repository }); default: _logger.Error($"Unknown Server Scope {settings.Scope}"); return(Enumerable.Empty <RepositorySettings>()); } }
private async Task <IReadOnlyCollection <RepositorySettings> > FromOrganisation( IGitHub gitHub, string organisationName, SourceControlServerSettings settings) { var allOrgRepos = await gitHub.GetRepositoriesForOrganisation(organisationName); var usableRepos = allOrgRepos .Where(r => MatchesIncludeExclude(r, settings)) .Where(RepoIsModifiable) .ToList(); if (allOrgRepos.Count > usableRepos.Count) { _logger.Detailed($"Can pull from {usableRepos.Count} repos out of {allOrgRepos.Count}"); } return(usableRepos .Select(r => new RepositorySettings(r)) .ToList()); }
public InterceptionBenchmarks() { var builderForBytes = new HttpRequestInterceptionBuilder() .ForHttps() .ForHost("files.domain.com") .ForPath("setup.exe") .WithMediaType("application/octet-stream") .WithContent(() => new byte[] { 0, 1, 2, 3, 4 }); var builderForHtml = new HttpRequestInterceptionBuilder() .ForHttp() .ForHost("www.google.co.uk") .ForPath("search") .ForQuery("q=Just+Eat") .WithMediaType("text/html") .WithContent(@"<!DOCTYPE html><html dir=""ltr"" lang=""en""><head><title>Just Eat</title></head></html>"); var builderForJson = new HttpRequestInterceptionBuilder() .ForHttps() .ForHost("api.github.com") .ForPath("orgs/justeat") .WithMediaType("application/json") .WithJsonContent(new { id = 1516790, login = "******", url = "https://api.github.com/orgs/justeat" }); var builderForStream = new HttpRequestInterceptionBuilder() .ForHttps() .ForHost("api.github.com") .ForPath("orgs/justeat") .ForQuery("page=1") .WithMediaType("application/json") .WithContentStream(() => File.OpenRead("organization.json")); _options = new HttpClientInterceptorOptions() .Register(builderForBytes) .Register(builderForHtml) .Register(builderForJson) .Register(builderForStream); _client = _options.CreateHttpClient(); _service = RestService.For <IGitHub>(_options.CreateHttpClient("https://api.github.com")); }
public ForkFinder(IGitHub gitHub, UserSettings settings, INuKeeperLogger logger) { _gitHub = gitHub; _forkMode = settings.ForkMode; _logger = logger; }
public HomeController(IGitHub api) { _Api = api; }
public RepositoryFilter(IGitHub gitHubClient, INuKeeperLogger logger) { _gitHubClient = gitHubClient; _logger = logger; }
public ReposController(IConfiguration configuration, IGitHub github) { _configuration = configuration; _github = github; }
public ForkFinder(IGitHub gitHub, INuKeeperLogger logger) { _gitHub = gitHub; _logger = logger; }
public GitHubAppUpdater(IGitHub gitHub, AppUpdateDetail appUpdateDetail) { _appUpdateDetail = appUpdateDetail; _gitHub = gitHub; }
private static IGitHubRepositoryDiscovery MakeGithubRepositoryDiscovery(IGitHub gitHub, ModalSettings settings) { return(new GitHubRepositoryDiscovery(gitHub, settings, Substitute.For <INuKeeperLogger>())); }
public ExistingBranchFilter(IGitHub gitHub, INuKeeperLogger logger) { _gitHub = gitHub; _logger = logger; }