Exemple #1
0
        public void Process(InstallationRegistered @event)
        {
            var tenantId       = _executionContextManager.Current.Tenant;
            var installationId = new Octokit.InstallationId(@event.InstallationId);

            _tenantMapper.AssociateTenantWithInstallation(installationId.Id, tenantId);
        }
Exemple #2
0
 void On(InstallationRegistered @event)
 {
     _installations[@event.InstallationId] = new Installation(
         @event.InstallationId,
         @event.TargetType,
         @event.TargetAccount,
         @event.Repositories.Select(_ => (RepositoryFullName)_)
         );
 }
        public void Process(InstallationRegistered @event)
        {
            var installationTenantId = _executionContextManager.Current.Tenant;
            var installationGithubId = @event.InstallationId;

            // Save the mapping
            using (var file = new StreamWriter("./webhooks-mapping.txt", true))
            {
                file.Write(installationGithubId);
                file.Write(" -> ");
                file.WriteLine(installationTenantId);
            }
        }
        public void Process(InstallationRegistered @event)
        {
            var installationsList = _repositoryForInstallationsList.GetById(0);

            installationsList.Installations.Add(@event.InstallationId);
            _repositoryForInstallationsList.Update(installationsList);

            var repositoriesList = _repositoryForRepositoriesList.GetById(0);

            @event.Repositories.ForEach(name => repositoriesList.Repositories.Add(name));
            _repositoryForRepositoriesList.Update(repositoriesList);

            _repositoryForInstallationRepositories.Insert(new InstallationRepositories {
                Id           = @event.InstallationId,
                Repositories = new List <RepositoryFullName>(@event.Repositories.Select(_ => (RepositoryFullName)_)),
            });
        }
Exemple #5
0
        public async void Process(InstallationRegistered @event)
        {
            await _lock.WaitAsync();

            var installationsList = GetOrCreateGlobalInstallationsList();

            installationsList.Installations.Add(@event.InstallationId);
            _repositoryForInstallationsList.Update(installationsList);

            var repositoriesList = GetOrCreateGlobalRepositoriesList();

            @event.Repositories.ForEach(name => repositoriesList.Repositories.Add(name));
            _repositoryForRepositoriesList.Update(repositoriesList);

            var installation = GetOrCreateInstallationById(@event.InstallationId);

            installation.Repositories = new List <RepositoryFullName>(@event.Repositories.Select(_ => (RepositoryFullName)_));
            _repositoryForInstallationRepositories.Update(installation);

            _lock.Release();
        }