forked from gomzyakov/good-first-issues.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.php
30 lines (22 loc) · 769 Bytes
/
generate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
declare(strict_types=1);
require_once('./vendor/autoload.php');
use GoodFirstIssue\Generator;
use GoodFirstIssue\GitHubAPIClient;
use GuzzleHttp\Client;
$clients_config = [
'base_uri' => 'https://api.github.com/',
];
// Get GITHUB_TOKEN from env-variable
$gh_token = getenv('GITHUB_TOKEN');
if (is_string($gh_token)) {
$clients_config['headers'] = ['Authorization' => 'Bearer ' . $gh_token];
print_r('Success: ENV-variable GITHUB_TOKEN was set.' . PHP_EOL );
} else {
print_r('Warning: ENV-variable GITHUB_TOKEN not found.' . PHP_EOL);
}
// Init Guzzle client with headers
$client = new Client($clients_config);
$github_api_client = new GitHubAPIClient($client);
$generator = new Generator(__DIR__, $github_api_client);
$generator->run();