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); }
public static string CommandName(this PRCommentCreated comment) { var rawComment = comment?.comment?.body; if (rawComment?.Trim() == CreateWorkItemComment) { return(CreateWorkItemCommand); } else { // there is no much. return(null); } }
public async Task <JObject> GetParentReviewAsync([ActivityTrigger] PRCommentCreated comment, ILogger log) { try { // GitHub Client Library's domain object can't serializable. var result = await _gitHubRepository.GetSingleComment(comment.comment.in_reply_to_id); return(result.ToJObject()); } catch (Exception e) { // GitHub Client Library's exception can't serializable throw new ArgumentException(e.Message); } }
protected abstract Task <PullRequestStateContext> ExecuteAsync(IDurableOrchestrationContext context, PullRequestStateContext pullRequestDetailContext, PRCommentCreated comment, JObject parentReviewComment, EntityId entityId);