|
11 | 11 | use Doctrine\ORM\ORMSetup; |
12 | 12 | use Doctrine\ORM\Tools\Console\ConsoleRunner; |
13 | 13 | use Doctrine\ORM\Tools\Console\EntityManagerProvider\SingleManagerProvider; |
| 14 | +use Github\AuthMethod; |
14 | 15 | use Github\Client; |
15 | 16 | use League\CommonMark\Extension\CommonMarkCoreExtension; |
16 | 17 | use League\CommonMark\Extension\ExternalLink\ExternalLinkExtension; |
|
50 | 51 | use PhpSchool\Website\Action\SubmitWorkshop; |
51 | 52 | use PhpSchool\Website\Action\TrackDownloads; |
52 | 53 | use PhpSchool\Website\Blog\Generator; |
| 54 | +use PhpSchool\Website\Command\SyncContributors; |
53 | 55 | use PhpSchool\Website\Online\CloudWorkshopRepository; |
54 | 56 | use PhpSchool\Website\Online\Command\DownloadComposerPackageList; |
55 | 57 | use PhpSchool\Website\Online\Middleware\ExerciseRunnerRateLimiter; |
|
112 | 114 | $app->command('create-admin-user name email password', CreateAdminUser::class); |
113 | 115 | $app->command('generate-blog', GenerateBlog::class); |
114 | 116 | $app->command('download-composer-packages', DownloadComposerPackageList::class); |
| 117 | + $app->command('sync-contributors', SyncContributors::class); |
115 | 118 |
|
116 | 119 | ConsoleRunner::addCommands($app, new SingleManagerProvider($c->get(EntityManagerInterface::class))); |
117 | 120 |
|
|
189 | 192 | DownloadComposerPackageList::class => function (ContainerInterface $c): DownloadComposerPackageList { |
190 | 193 | return new DownloadComposerPackageList($c->get('guzzle.packagist'), $c->get(LoggerInterface::class)); |
191 | 194 | }, |
| 195 | + SyncContributors::class => function (ContainerInterface $c): SyncContributors { |
| 196 | + return new SyncContributors($c->get(Client::class), $c->get(LoggerInterface::class)); |
| 197 | + }, |
192 | 198 |
|
193 | 199 | TrackDownloads::class => function (ContainerInterface $c): TrackDownloads { |
194 | 200 | return new TrackDownloads($c->get(WorkshopRepository::class), $c->get(WorkshopInstallRepository::class)); |
|
212 | 218 | ); |
213 | 219 | }, |
214 | 220 |
|
| 221 | + Client::class => function (ContainerInterface $c): Client { |
| 222 | + $client = new Client(); |
| 223 | + $client->authenticate($c->get('config')['github']['token'], AuthMethod::ACCESS_TOKEN); |
| 224 | + |
| 225 | + return $client; |
| 226 | + }, |
| 227 | + |
215 | 228 | Github::class => function (ContainerInterface $c): Github { |
216 | 229 | return new Github([ |
217 | 230 | 'clientId' => $c->get('config')['github']['clientId'], |
@@ -582,6 +595,7 @@ public function parse($markdown): string |
582 | 595 | 'github' => [ |
583 | 596 | 'clientId' => $_ENV['GITHUB_CLIENT_ID'], |
584 | 597 | 'clientSecret' => $_ENV['GITHUB_CLIENT_SECRET'], |
| 598 | + 'token' => $_ENV['GITHUB_TOKEN'], |
585 | 599 | ], |
586 | 600 |
|
587 | 601 | 'jwtSecret' => $_ENV['JWT_SECRET'], |
|
0 commit comments