Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions changelog/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ protected function authenticateGithubClient(\Github\Client $client) {
throw new Exception('Credentials file is missing - please provide your credentials in credentials.json in the root folder.');
}

// Check the env variable
if (getenv('GITHUB_TOKEN')) {
$client->authenticate(getenv('GITHUB_TOKEN'), Github\Client::AUTH_ACCESS_TOKEN);
return;
}

$credentialsData = json_decode(file_get_contents(__DIR__ . '/../credentials.json'), true);
if (!is_array($credentialsData) || !isset($credentialsData['apikey'])) {
throw new Exception('Credentials file can not be read or does not provide "apikey".');
Expand Down Expand Up @@ -209,9 +215,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
throw new Exception('Credentials file is missing - please provide your credentials in credentials.json in the root folder.');
}

$credentialsData = json_decode(file_get_contents(__DIR__ . '/../credentials.json'), true);
if (!is_array($credentialsData) || !isset($credentialsData['apikey'])) {
throw new Exception('Credentials file can not be read or does not provide "apikey".');
// Check that we have valid credentials
if (!getenv('GITHUB_TOKEN')) {
$credentialsData = json_decode(file_get_contents(__DIR__ . '/../credentials.json'), true);
if (!is_array($credentialsData) || !isset($credentialsData['apikey'])) {
throw new Exception('Credentials file can not be read or does not provide "apikey".');
}
}

$format = $input->getOption('format');
Expand Down