public async Task <string> FetchPullRequestEventCommitMessage(PullRequestEvent pullRequestEvent) { var ownerName = pullRequestEvent.Repository.Owner.Login; var repoName = pullRequestEvent.Repository.Name; var commitSha = pullRequestEvent.PullRequest.Head.Sha; var response = await client.GetAsync <RepoCommit>($"https://api.github.com/repos/{ownerName}/{repoName}/commits/{commitSha}"); logger.LogInformation($"Received get commit response: {Serialize(response)}"); return(response.Commit.Message); }
private static void ValidatePullRequestBodyFormat(ApplicationLoadBalancerRequest request, out PullRequestEvent payload) { try { payload = Deserialize <PullRequestEvent>(request.Body); } catch (Exception e) { Console.WriteLine(e.Message + "\n" + e.StackTrace); throw new BodyNotJsonException(); } if (payload.Action != "opened" && payload.Action != "synchronize") { throw new ActionNotAllowedException(); } }