private bool CanProcess(PushInfoModel pushInfo)
        {
            using (var repoContext = _repositoryConnectionProvider.GetRepositoryConnection())
            {
                if (!_processPushPredicate.CanProcessPush(pushInfo, repoContext))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #2
0
 private void RemoveBranch(BranchName headBranchName)
 {
     using (var repoContext = _repositoryConnectionProvider.GetRepositoryConnection())
     {
         _logger.LogDebug("Removing temporary {branchName} branch from repository", headBranchName);
         try
         {
             repoContext.RemoveBranch(headBranchName);
         }
         catch (Exception e)
         {
             _logger.LogWarning(e, "Error when removing branch '{branchName}'. It could be deleted by human", headBranchName);
         }
     }
 }
        private void CheckForPullRequestsAndNotifyUsers()
        {
            _logger.LogInformation("CheckForPullRequestsAndNotifyUsers");
            using (var repoContext = _repositoryConnectionProvider.GetRepositoryConnection())
            {
                var openPullRequests = repoContext.GetOpenPullRequests();

                var filteredPullRequests = FilterPullRequests(openPullRequests);
                if (filteredPullRequests.Count > 0)
                {
                    _logger.LogInformation("Notifying users there is still open {count} pull requests", filteredPullRequests.Count);
                    _userNotifier.NotifyAboutOpenPullRequests(filteredPullRequests);
                }
            }
        }