示例#1
0
        public async Task OpenPullRequest(ForkData target, PullRequestRequest request, IEnumerable <string> labels)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            var repositories = await _client.GetGitRepositories(target.Owner);

            var targetRepository = repositories.FirstOrDefault(x => x.Name.Equals(target.Name, StringComparison.InvariantCultureIgnoreCase));

            var reviewers = await _client.GetBitBucketReviewers(target.Owner, targetRepository.Name);

            var pullReq = new PullRequest
            {
                Title       = request.Title,
                Description = request.Body,
                FromRef     = new Ref
                {
                    Id = request.Head
                },
                ToRef = new Ref
                {
                    Id = request.BaseRef
                },
                Reviewers = reviewers.ToList()
            };

            await _client.CreatePullRequest(pullReq, target.Owner, targetRepository.Name);
        }
        public async Task OpenPullRequest(ForkData target, PullRequestRequest request, IEnumerable <string> labels)
        {
            var repositories = await _client.GetGitRepositories(target.Owner);

            var targetRepository = repositories.FirstOrDefault(x => x.Name.Equals(target.Name, StringComparison.InvariantCultureIgnoreCase));

            var pullReq = new PullRequest
            {
                Title       = request.Title,
                Description = request.Body,
                FromRef     = new Ref
                {
                    Id = request.Head
                },
                ToRef = new Ref
                {
                    Id = request.BaseRef
                }
            };

            await _client.CreatePullRequest(pullReq, target.Owner, targetRepository.Name);
        }