示例#1
0
        public async Task Execute()
        {
            _logger.LogTrace($"Starting CheckPullRequestStatusJob.");
            var repos = await _repo.GetAll();

            foreach (var repo in repos)
            {
                var prs = await GetPullRequests(repo);

                if (prs != null)
                {
                    var squidPrs = prs.Where(p => p.title == SquidConfig.BranchName);
                    foreach (var squidPr in squidPrs)
                    {
                        // Get the status of the PR.
                        var prStatus = await GetPRStatus(repo, squidPr.id);

                        if (prStatus != null && prStatus.state == "SUCCESSFUL")
                        {
                            // The squid PR built successfully, let's merge it.
                            await MergePR(repo, squidPr.id);
                        }
                        else
                        {
                            string status = prStatus != null ? prStatus.state : "unknown";
                            _logger.LogInformation($"Skipped merging pull request {squidPr.id} of '{repo.RepoSlug}' because it is '{status}'.");
                        }
                    }
                }
            }
        }
示例#2
0
        public async Task Execute()
        {
            _logger.LogTrace($"Starting DependencyJob.");
            var repos = await _repo.GetAll();

            foreach (var repo in repos)
            {
                var repoModel    = _mapper.Map <RepositoryConfigModel>(repo);
                var dependencies = await GetDependencies(repo);

                if (dependencies != null)
                {
                    Dependencies serviceDependencies;
                    if (SquidStore.Dependencies.ContainsKey(repo.Id))
                    {
                        serviceDependencies                     = SquidStore.Dependencies[repo.Id];
                        serviceDependencies.Repository          = repoModel;
                        serviceDependencies.PackageDependencies = dependencies;
                        SquidStore.Dependencies[repo.Id]        = serviceDependencies;
                    }
                    else
                    {
                        serviceDependencies = new Dependencies()
                        {
                            Repository          = repoModel,
                            PackageDependencies = dependencies
                        };

                        SquidStore.Dependencies.TryAdd(repo.Id, serviceDependencies);
                    }
                }
            }
        }
示例#3
0
        public async Task <IActionResult> Get()
        {
            var repos = await _repo.GetAll();

            var returnModels = _mapper.Map <IEnumerable <RepositoryConfigModel> >(repos);

            return(Ok(returnModels));
        }