Exemple #1
0
        public async Task <List <PullRequestCheckStatus> > GetStatusChecks(MergeRequest mergeRequest)
        {
            var owner = mergeRequest.Owner;
            var repo  = mergeRequest.Repo;
            var sha   = mergeRequest.Sha;

            var uri = $"/repos/{owner}/{repo}/statuses/{sha}";

            logger.WithMergeRequestData(mergeRequest).Information($"Making github get status checks for PR request");

            return(await githubHttpClient.Get <List <PullRequestCheckStatus> >(uri));
        }
Exemple #2
0
        public async Task <FileContent> GetFile(string owner, string repo, string fileName)
        {
            logger.WithExtraData(new { owner, repo, fileName }).Information("Fetching file from repo");
            try
            {
                var payload = await githubHttpClient.Get <FileContent>($"/repos/{owner}/{repo}/contents/{fileName}");

                if (payload == null)
                {
                    logger.WithExtraData(new { owner, repo, fileName }).Information("File not found");
                    return(null);
                }
                logger.WithExtraData(new { owner, repo, fileName, name = payload.Name, sha = payload.Sha, content = payload.Content }).Information("File found from repo");
                return(payload);
            }
            catch (Exception e)
            {
                logger.WithExtraData(new { owner, repo, fileName }).Information("File not found");
                return(null);
            }
        }
Exemple #3
0
        public async Task <RequestedReviewersResponse> GetRequestedReviewers(string owner, string repo, int prId)
        {
            var reviewRequests = await githubHttpClient.Get <RequestedReviewersResponse>($"/repos/{owner}/{repo}/pulls/{prId}/requested_reviewers");

            return(reviewRequests);
        }