Пример #1
0
        private static async Task TransferIssues(string githubRepo)
        {
            var issues = await GitlabApi.GetProjectIssues();

            // var issues = new JArray(await GitlabApi.GetIssue(80));

            int count = 1, tot = issues.Count;

            foreach (var issue in issues)
            {
                Console.Write($"\rissue {count} of {tot}");
                var issueId  = issue["iid"].ToObject <int>();
                var comments = await GitlabApi.GetIssueComments(issueId);

                var githubId = await GitHubApi.CreateIssue(new
                {
                    Title = issue["title"].Value <string>(),
                    Body  =
                        $"{issue["description"].Value<string>()}\n\n > Created By: {issue["author"]["name"].Value<string>()}",
                    Labels = issue["labels"].ToObject <string[]>()
                }, githubRepo);

                foreach (var comment in comments)
                {
                    await GitHubApi.AddCommentToIssue(new
                    {
                        Body = $@"{comment["body"].ToObject<string>()}

> Created By: {comment["author"]["name"].ToObject<string>()}
> Created At: {DateTime.Parse(comment["created_at"].ToObject<string>()):MM/dd/yyyy hh:mm tt}"
                    }, githubRepo, githubId);