Пример #1
0
        public PullRequestManager(
            IAuthorizationService authorizationService,
            ReviewManager reviewManager,
            CosmosReviewRepository reviewsRepository,
            CosmosPullRequestsRepository pullRequestsRepository,
            BlobCodeFileRepository codeFileRepository,
            DevopsArtifactRepository devopsArtifactRepository,
            IConfiguration configuration
            )
        {
            _reviewManager            = reviewManager;
            _pullRequestsRepository   = pullRequestsRepository;
            _configuration            = configuration;
            _reviewsRepository        = reviewsRepository;
            _codeFileRepository       = codeFileRepository;
            _devopsArtifactRepository = devopsArtifactRepository;
            _authorizationService     = authorizationService;
            var ghToken = _configuration["github-access-token"];

            if (ghToken != null)
            {
                _githubClient.Credentials = new Credentials(ghToken);
            }

            var pullRequestReviewCloseAfter = _configuration["pull-request-review-close-after-days"] ?? "30";

            _pullRequestCleanupDays = int.Parse(pullRequestReviewCloseAfter);
            _allowedListBotAccounts = new HashSet <string>();
            var botAllowedList = _configuration["allowedList-bot-github-accounts"];

            if (!string.IsNullOrEmpty(botAllowedList))
            {
                _allowedListBotAccounts.UnionWith(botAllowedList.Split(","));
            }
        }
Пример #2
0
        public PullRequestManager(
            IAuthorizationService authorizationService,
            ReviewManager reviewManager,
            CosmosReviewRepository reviewsRepository,
            CosmosPullRequestsRepository pullRequestsRepository,
            BlobCodeFileRepository codeFileRepository,
            DevopsArtifactRepository devopsArtifactRepository,
            IConfiguration configuration
            )
        {
            _reviewManager            = reviewManager;
            _pullRequestsRepository   = pullRequestsRepository;
            _configuration            = configuration;
            _reviewsRepository        = reviewsRepository;
            _codeFileRepository       = codeFileRepository;
            _devopsArtifactRepository = devopsArtifactRepository;
            _authorizationService     = authorizationService;
            _githubClient.Credentials = new Credentials(_configuration["github-access-token"]);

            var pullRequestReviewCloseAfter = _configuration["pull-request-review-close-after-days"] ?? "30";

            _pullRequestCleanupDays = int.Parse(pullRequestReviewCloseAfter);
        }