예제 #1
0
        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);
        }
예제 #2
0
        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();
            }
        }