public IHttpActionResult Post([FromBody] JiraCommentRequest request) { string issueKey = request.IssueKey; string comment = request.Comment; var issue = _jira.GetIssueDetails(issueKey); if (issue == null) { return(BadRequest($"No issue with key '{issueKey}' exists.")); } _jira.PostComment(issueKey, comment); return(Ok()); }
private void HandleMergeRequests() { while (!_mergeRequests.IsCompleted) { var mergeRequest = _mergeRequests.Take(); var mergeResults = Merge(mergeRequest); if (!mergeResults.Any()) { Logger.Info(m => m("No merge results returned from an attempted merge. This usually means that none of the configured repositories had a matching branch")); // TODO: should we treat this as a case where we want to ping the Jira issue? } else { string jiraComment = BuildJiraComment(mergeRequest, mergeResults); _jira.PostComment(mergeRequest.IssueDetails.Key, jiraComment); } } }