File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,12 @@ protected function authenticateGithubClient(\Github\Client $client) {
174174 throw new Exception ('Credentials file is missing - please provide your credentials in credentials.json in the root folder. ' );
175175 }
176176
177+ // Check the env variable
178+ if (getenv ('GITHUB_TOKEN ' )) {
179+ $ client ->authenticate (getenv ('GITHUB_TOKEN ' ), Github \Client::AUTH_ACCESS_TOKEN );
180+ return ;
181+ }
182+
177183 $ credentialsData = json_decode (file_get_contents (__DIR__ . '/../credentials.json ' ), true );
178184 if (!is_array ($ credentialsData ) || !isset ($ credentialsData ['apikey ' ])) {
179185 throw new Exception ('Credentials file can not be read or does not provide "apikey". ' );
@@ -209,9 +215,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
209215 throw new Exception ('Credentials file is missing - please provide your credentials in credentials.json in the root folder. ' );
210216 }
211217
212- $ credentialsData = json_decode (file_get_contents (__DIR__ . '/../credentials.json ' ), true );
213- if (!is_array ($ credentialsData ) || !isset ($ credentialsData ['apikey ' ])) {
214- throw new Exception ('Credentials file can not be read or does not provide "apikey". ' );
218+ // Check that we have valid credentials
219+ if (!getenv ('GITHUB_TOKEN ' )) {
220+ $ credentialsData = json_decode (file_get_contents (__DIR__ . '/../credentials.json ' ), true );
221+ if (!is_array ($ credentialsData ) || !isset ($ credentialsData ['apikey ' ])) {
222+ throw new Exception ('Credentials file can not be read or does not provide "apikey". ' );
223+ }
215224 }
216225
217226 $ format = $ input ->getOption ('format ' );
You can’t perform that action at this time.
0 commit comments