static async Task Main(string[] args) { ParameterStore parameterStore = new ParameterStore(); if (await parameterStore.InitializeAsync(args)) { ISynchronizer Synchronizer = new DefaultSynchronizer(_logger, await parameterStore.QueryParameterAsync <UriParameter>(), await parameterStore.QueryParameterAsync <OautTokenParameter>()); OrganizationNameParameter sourceOrganizationNameParameter = await parameterStore.QueryParameterAsync <SourceOrganizationNameParameter>(); OrganizationNameParameter targetOrganizationParameter = await parameterStore.QueryParameterAsync <TargetOrganizationNameParameter>() ?? sourceOrganizationNameParameter; SourceRepositoryNameParameter sourceRepositoryNameParameter = await parameterStore.QueryParameterAsync <SourceRepositoryNameParameter>(); TargetRepositoryNameParameter targetRepositoryNameParameter = await parameterStore.QueryParameterAsync <TargetRepositoryNameParameter>(); StrictFlagParameter strictFlagParameter = await parameterStore.QueryParameterAsync <StrictFlagParameter>(); if (targetRepositoryNameParameter == null) { await Synchronizer.SynchronizeAsync(sourceOrganizationNameParameter, sourceRepositoryNameParameter, targetOrganizationParameter, strictFlagParameter); } else { await Synchronizer.SynchronizeAsync(sourceOrganizationNameParameter, await parameterStore.QueryParameterAsync <SourceRepositoryNameParameter>(), targetOrganizationParameter, targetRepositoryNameParameter, strictFlagParameter); } } else { await WriteHelpAsync(); } Console.ReadKey(); }
public override async Task SynchronizeAsync(OrganizationNameParameter sourceOrganizationNameParameter, RepositoryNameParameter repositoryNameParameter, OrganizationNameParameter targetOrganizationNameParameter, StrictFlagParameter strictFlagParameter) { Repository sourceRepository = await GitHubClient.Repository.Get(sourceOrganizationNameParameter.Value, repositoryNameParameter.Value); Organization organization = await GitHubClient.Organization .Get(targetOrganizationNameParameter.Value); IReadOnlyList <Repository> repositories = await GetRepositoriesAsync(sourceRepository, organization); await SynchronizeRepositoriesLabels(strictFlagParameter, sourceRepository, repositories); }
public override async Task SynchronizeAsync(OrganizationNameParameter sourceOrganizationLoginNameParameter, RepositoryNameParameter sourceRepositoryNameParameter, OrganizationNameParameter targetOrganizationLoginNameParameter, RepositoryNameParameter targetRepositoryNameParameter, StrictFlagParameter strictFlagParameter) { if (string.Equals(sourceRepositoryNameParameter.Value, targetRepositoryNameParameter.Value)) { WriteLog($"Synchronization stopped. Repo '{sourceRepositoryNameParameter.Value}' and '{targetRepositoryNameParameter.Value}' have to be different", ConsoleColor.Red); return; } Repository sourceRepository = await GitHubClient.Repository.Get(sourceOrganizationLoginNameParameter.Value, sourceRepositoryNameParameter.Value); Repository targetRepository = await GitHubClient.Repository.Get(targetOrganizationLoginNameParameter.Value, targetRepositoryNameParameter.Value); await SynchronizeRepositoriesLabels(strictFlagParameter, sourceRepository, new[] { targetRepository }); }
public abstract Task SynchronizeAsync(OrganizationNameParameter sourceOrganizationLoginNameParameter, RepositoryNameParameter sourceRepositoryNameParameter, OrganizationNameParameter targetOrganizationLoginNameParameter, RepositoryNameParameter targetRepositoryNameParameter, StrictFlagParameter strictFlagParameter);