Beispiel #1
0
        protected override async Task OnExecuteAsync(CommandLineApplication application)
        {
            (string owner, string repositoryName) = parseRepository();
            string environmentHost          = Environment.GetEnvironmentVariable(Constant.EnvironmentHost);
            string environmentToken         = Environment.GetEnvironmentVariable(Constant.EnvironmentToken);
            var    giteaApi                 = new GiteaApi(Host ?? environmentHost, Token ?? environmentToken, owner, repositoryName);
            var    labelDifferenceProcessor = new LabelDifferenceProcessor(giteaApi);

            IReadOnlyList <Label> repositoryLabels = await giteaApi.GetLabelsAsync();

            IReadOnlyList <Label> configuredLabels = readLabels();
            IReadOnlyList <LabelChangeStrategy> labelChangeStrategies = labelDifferenceProcessor.Process(repositoryLabels, configuredLabels);

            Console.WriteLine($"{owner}/{repositoryName} label will be:");

            foreach (var labelChangeStrategy in labelChangeStrategies)
            {
                Console.WriteLine(labelChangeStrategy.ToString());
            }

            if (IsDryRun is false)
            {
                foreach (var labelChangeStrategy in labelChangeStrategies)
                {
                    await labelChangeStrategy.ChangeLabelAsync();
                }
            }
            else
            {
                Console.WriteLine("Dry Run: Not apply to Gitea.");
            }
        }
        protected override async Task OnExecuteAsync(CommandLineApplication application)
        {
            (string owner, string repositoryName) = parseRepository();
            string environmentHost  = Environment.GetEnvironmentVariable(Constant.EnvironmentHost);
            string environmentToken = Environment.GetEnvironmentVariable(Constant.EnvironmentToken);
            var    giteaApi         = new GiteaApi(Host ?? environmentHost, Token ?? environmentToken, owner, repositoryName);

            IReadOnlyList <Label> labels = await giteaApi.GetLabelsAsync();

            Console.WriteLine($"{owner}/{repositoryName} label are:");

            foreach (var label in labels)
            {
                Console.WriteLine(label.ToString());
            }

            if (OutputFileName is { })