Example #1
0
        public Task CreateReplyComment([ActivityTrigger] CreateReplyParamter parameter)
        {
            var body = $"WorkItem {parameter.WorkItem.Id} Created see [workItem]({((Microsoft.VisualStudio.Services.WebApi.ReferenceLink)parameter.WorkItem.Links.Links["html"]).Href}).";

            return(_gitHubRepository.CreatePullRequestReplyComment(parameter.PullRequestNumber, body,
                                                                   parameter.InReplyTo));
        }
Example #2
0
        protected override async Task <PullRequestStateContext> ExecuteAsync(IDurableOrchestrationContext context,
                                                                             PullRequestStateContext pullRequestDetailContext,
                                                                             PRCommentCreated comment, JObject parentReviewComment, EntityId entityId)
        {
            if (!pullRequestDetailContext.HasCreatedWorkItem(comment.comment.id))
            {
                WorkItem createdWorkItem =
                    await context.CallActivityAsync <WorkItem>(nameof(CreateWorkItemCommand) + "_CreateWorkItem",
                                                               (parentReviewComment, pullRequestDetailContext));

                pullRequestDetailContext.Add(
                    new CreatedWorkItem()
                {
                    CommentId = comment.comment.id
                });

                var createReplyparameter = new CreateReplyParamter()
                {
                    PullRequestNumber = comment.pull_request.number,
                    InReplyTo         = (int)parentReviewComment["Id"],
                    WorkItem          = createdWorkItem
                };

                await context.CallActivityAsync(nameof(CreateWorkItemCommand) + "_CreateReplyComment",
                                                createReplyparameter);
            }

            return(pullRequestDetailContext);
        }