コード例 #1
0
        private async Task <Issue> CreateDeprecationNoticeAsync(NewAzureDeprecationV1Message newNoticeV1MessageQueueMessage)
        {
            // Determine deprecation year
            var deprecationYear = newNoticeV1MessageQueueMessage.GetDueDate().Year;

            // Get matching milestone
            var milestoneDueDate = DateTimeOffset.Parse($"12/31/{deprecationYear}").AddDays(1);
            var milestone        = await _gitHubRepository.GetOrCreateMilestoneAsync(deprecationYear.ToString(),
                                                                                     $"All Azure deprecation notices which are closing in {deprecationYear}", milestoneDueDate);

            // Get matching project
            var project = await _gitHubRepository.GetOrCreateProjectAsync("Deprecation Notice Timeline");

            // Generate issue content
            var issueContent = IssueFactory.GenerateNewDeprecationNotice(newNoticeV1MessageQueueMessage);

            // Determine all required labels
            var labels = DetermineRequiredLabels(newNoticeV1MessageQueueMessage);

            // Create GitHub issue
            var createdIssue = await _gitHubRepository.CreateIssueAsync(newNoticeV1MessageQueueMessage.Title, issueContent, milestone, labels);

            // Add GitHub issue to deprecation notice project
            await _gitHubRepository.AddIssueToProjectAsync(project.Id, deprecationYear.ToString(), createdIssue.Id);

            return(createdIssue);
        }