Ejemplo n.º 1
0
        protected override async Task OnExecuteAsync()
        {
            var repositoryClient = _githubService.GetGithubClient().Repository;

            _console.Write($"Loading Repository {UserName}/{Repository}: ", NoStatus);
            var repository = await _githubService.GetUserRepository();

            _console.WriteLine("Done", Success);

            _console.Write("Loading Repository Commits: ", NoStatus);
            var commits = await _githubService.GetCommitsOfUserRepositoryForSpecifiedBranch();

            _console.WriteLine("Done", Success);

            _console.Write("Loading Repository Releases: ", NoStatus);
            var releases = (await _githubService.GetReleasesOfUserRepository())
                           .OrderByDescending(o => o.CreatedAt)
                           .ThenByDescending(o => o.PublishedAt ?? o.CreatedAt)
                           .ToList().AsReadOnly();

            _console.WriteLine("Done", Success);

            _console.Write("Loading Repository Tags: ", NoStatus);
            var tags = await _githubService.GetTagsOfUserRepository();

            _console.WriteLine("Done", Success);

            _console.Write("Create Repository Changelog: ", NoStatus);
            var document = await _changelogParser.Parse(
                repository,
                commits,
                releases,
                tags);

            _console.WriteLine("Done", Success);

            _console.Write("Commit generated Changelog-File: ", NoStatus);
            await UpdateChangelogFileInRepository(repositoryClient, repository, document);

            _console.WriteLineEnter("Done", Success);
            _console.WriteLineEnter("Generated Changelog: ", NoStatus);
            _console.Write(document);
        }