private void UpdatePullRequestReview(JObject contents, IGitHubPullRequestChanges gitHubPullRequestChanges) { var targetPrId = contents["pull_request"]["number"].ToString(); var state = GitHubConverters.ToApprovalState(contents["review"]["state"].ToString()); if (state.HasValue) { gitHubPullRequestChanges.ReceivePullRequestReview(id: targetPrId, review: new GitService.PullRequestReview { Author = contents["review"]["user"]["login"].ToString(), State = state.Value, SubmittedDate = contents["review"].Value <DateTimeOffset>("submitted_at").ToString("s", System.Globalization.CultureInfo.InvariantCulture), Url = contents["review"]["_links"]["html"]["href"].ToString() }, remove: contents["action"].ToString() == "dismissed"); } }
private void UpdatePullRequest(JObject contents, IGitHubPullRequestChanges gitHubPullRequestChanges) { var entry = contents["pull_request"]; gitHubPullRequestChanges.ReceivePullRequestUpdate(new GitService.PullRequest { Id = entry["number"].ToString(), Created = entry["created_at"].Value <DateTimeOffset>().ToString("s", System.Globalization.CultureInfo.InvariantCulture), Author = entry["user"]["login"].ToString(), State = entry["state"].ToString().ToUpper() == "OPEN" ? PullRequestState.Open : PullRequestState.Closed, TargetBranch = entry["base"]["ref"].ToString(), SourceBranch = entry["head"]["ref"].ToString(), Url = entry["_links"]["html"]["href"].ToString(), Reviews = null }); }