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); }
private async Task CreateWorkItem(IDurableOrchestrationContext context, PullRequestStateContext pullRequestStateContext, CommandHookContext commandHookContext) { CreatedReviewComment parentReviewComment = GetParentReviewCommentAsync(pullRequestStateContext, commandHookContext); var issue = await GetIssueAsync(context, pullRequestStateContext, parentReviewComment); // Create WorkItem that match WorkItem Provider var workItem = await context.CallActivityAsync <WorkItem>( nameof(CommandOrchestrator) + "_" + BotConfiguration.WorkItemProvider + "_CreateWorkItem", new CreateWorkItemContext() { Issue = issue, CreatedReviewComment = parentReviewComment, PullRequestId = pullRequestStateContext.PullRequestId }); // Create Comment that match Repository Provider await context.CallActivityAsync( nameof(CommandOrchestrator) + "_" + BotConfiguration.RepositoryProvider + "_CreateWorkItemReplyComment", new CreateWorkItemReplyCommentContext() { WorkItem = workItem, InReplyTo = parentReviewComment.CommentId, PullRequestId = pullRequestStateContext.PullRequestId }); // Update the PullRequestStateContext pullRequestStateContext.Add(new CreatedWorkItem() { CommentId = parentReviewComment.CommentId, }); }