GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 6a3289...514d99 )
by Anton
02:27
created

contrib/grafana.php (1 issue)

Severity
1
<?php
2
/* (c) beeete2 <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer;
9
10
use Deployer\Utility\Httpie;
11
12
13
desc('Create Grafana annotation of deployment');
14
task('grafana:annotation', function () {
15
    $defaultConfig = [
16
        'url' => null,
17
        'token' => null,
18
        'time' => round(microtime(true) * 1000),
19
        'tags' => [],
20
        'text' => null,
21
    ];
22
23
    $config = array_merge($defaultConfig, (array) get('grafana'));
24
    if (!is_array($config) || !isset($config['url']) || !isset($config['token'])) {
0 ignored issues
show
The condition is_array($config) is always true.
Loading history...
25
        throw new \RuntimeException("Please configure Grafana: set('grafana', ['url' => 'https://localhost/api/annotations', token' => 'eyJrIjo...']);");
26
    }
27
28
    $params = [
29
        'time' => $config['time'],
30
        'isRegion' => false,
31
        'tags' => $config['tags'],
32
        'text' => $config['text'],
33
    ];
34
    if (!isset($params['text'])) {
35
        $params['text'] = 'Deployed ' . trim(runLocally('git log -n 1 --format="%h"'));
36
    }
37
38
    Httpie::post($config['url'])
39
        ->header('Authorization: Bearer ' . $config['token'])
40
        ->header('Content-type: application/json')
41
        ->body($params)
42
        ->send();
43
});
44