public async Task <IActionResult> UpdatedPr([FromBody] DevOpsPullRequestNotification devopspr) { if (devopspr.IsValid()) { var pr = devopspr.To(); if (await _prService.HandleUpdatedPullRequest(pr).ConfigureAwait(false)) { return(new OkResult()); } } return(BadRequest()); }
public static string FormatPrUrl(DevOpsPullRequestNotification pr) { var projectUrl = pr.Resource.Repository.Project.Url; var regex = Regex.Match(projectUrl, OrganizationRegex); if (regex.Success) { var org = Uri.EscapeUriString(regex.Groups[2].Value); var project = Uri.EscapeUriString(pr.Resource.Repository.Project.Name); var repository = Uri.EscapeUriString(pr.Resource.Repository.Name); var id = pr.Resource.PullRequestId; return($"https://dev.azure.com/{org}/{project}/_git/{repository}/pullrequest/{id}"); } return(null); }