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.

Code

< 40 %
40-60 %
> 60 %
1
<?php
2
namespace Deployer;
3
4
require __DIR__ . '/deploy/check_remote.php';
5
require __DIR__ . '/deploy/cleanup.php';
6
require __DIR__ . '/deploy/clear_paths.php';
7
require __DIR__ . '/deploy/copy_dirs.php';
8
require __DIR__ . '/deploy/info.php';
9
require __DIR__ . '/deploy/lock.php';
10 8
require __DIR__ . '/deploy/release.php';
11 8
require __DIR__ . '/deploy/rollback.php';
12 8
require __DIR__ . '/deploy/setup.php';
13 8
require __DIR__ . '/deploy/shared.php';
14 8
require __DIR__ . '/deploy/symlink.php';
15 8
require __DIR__ . '/deploy/update_code.php';
16 8
require __DIR__ . '/deploy/vendors.php';
17 8
require __DIR__ . '/deploy/writable.php';
18 8
19 8
require __DIR__ . '/provision/provision.php';
20 8
21 8
use Deployer\Exception\RunException;
22 8
use Symfony\Component\Console\Input\InputOption;
23 8
use Symfony\Component\Console\Output\Output;
24
25 8
/**
26
 * Facts
27
 */
28
29
set('user', function () {
30
    if (getenv('CI') !== false) {
31
        return 'ci';
32
    }
33
34
    try {
35
        return runLocally('git config --get user.name');
36 5
    } catch (RunException $exception) {
37 5
        try {
38
            return runLocally('whoami');
39
        } catch (RunException $exception) {
40
            return 'no_user';
41
        }
42
    }
43
});
44
45
/**
46
 * Configuration
47
 */
48
49 8
set('keep_releases', 5);
50
51
set('repository', ''); // Repository to deploy.
52
53
set('shared_dirs', []);
54
set('shared_files', []);
55 8
56
set('copy_dirs', []);
57 8
58
set('writable_dirs', []);
59 8
set('writable_mode', 'acl'); // chmod, chown, chgrp or acl.
60 8
set('writable_use_sudo', false); // Using sudo in writable commands?
61
set('writable_recursive', true); // Common for all modes
62 8
set('writable_chmod_mode', '0755'); // For chmod mode
63
set('writable_chmod_recursive', true); // For chmod mode only (if is boolean, it has priority over `writable_recursive`)
64 8
65 8
set('http_user', false);
66 8
set('http_group', false);
67 8
68 8
set('clear_paths', []);         // Relative path from release_path
69 8
set('clear_use_sudo', false);    // Using sudo in clean commands?
70
71 8
set('cleanup_use_sudo', false); // Using sudo in cleanup commands?
72 8
73
set('use_relative_symlink', function () {
74 8
    return commandSupportsOption('ln', '--relative');
75 8
});
76
set('use_atomic_symlink', function () {
77 8
    return commandSupportsOption('mv', '--no-target-directory');
78
});
79
80 5
set('composer_action', 'install');
81 8
set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest');
82
83 3
set('env', []); // Run command environment (for example, SYMFONY_ENV=prod)
84 8
85
/**
86 8
 * Return current release path.
87 8
 */
88
set('current_path', function () {
89 8
    $link = run("readlink {{deploy_path}}/current");
90
    return substr($link, 0, 1) === '/' ? $link : get('deploy_path') . '/' . $link;
91
});
92
93
94
/**
95
 * Custom bins
96
 */
97 8
set('bin/php', function () {
98
    return locateBinaryPath('php');
99
});
100
101
set('bin/git', function () {
102
    return locateBinaryPath('git');
103
});
104 3
105 8
set('bin/composer', function () {
106
    if (commandExist('composer')) {
107
        $composer = '{{bin/php}} ' . locateBinaryPath('composer');
108 4
    }
109 8
110
    if (empty($composer)) {
111
        run("cd {{release_path}} && curl -sS https://getcomposer.org/installer | {{bin/php}}");
112 3
        $composer = '{{bin/php}} {{release_path}}/composer.phar';
113 3
    }
114
115
    return $composer;
116 3
});
117
118
set('bin/symlink', function () {
119
    return get('use_relative_symlink') ? 'ln -nfs --relative' : 'ln -nfs';
120
});
121 3
122 8
// Path to a file which will store temp script with sudo password.
123
// Defaults to `.dep/sudo_pass`. This script is only temporary and will be deleted after
124
// sudo command executed.
125 5
set('sudo_askpass', function () {
126 8
    if (test('[ -d {{deploy_path}}/.dep ]')) {
127
        return '{{deploy_path}}/.dep/sudo_pass';
128
    } else {
129
        return '/tmp/dep_sudo_pass';
130
    }
131
});
132
133
/**
134 8
 * Default options
135
 */
136
option('tag', null, InputOption::VALUE_REQUIRED, 'Tag to deploy');
137
option('revision', null, InputOption::VALUE_REQUIRED, 'Revision to deploy');
138
option('branch', null, InputOption::VALUE_REQUIRED, 'Branch to deploy');
139 8
140 8
141 8
task('deploy:prepare', [
142
    'deploy:info',
143
    'deploy:setup',
144 8
    'deploy:lock',
145 8
    'deploy:release',
146
    'deploy:update_code',
147
    'deploy:shared',
148
    'deploy:writable',
149
]);
150
151
task('deploy:publish', [
152
    'deploy:symlink',
153
    'deploy:unlock',
154 8
    'deploy:cleanup',
155 8
    'deploy:success',
156
]);
157
158
/**
159
 * Success message
160
 */
161
task('deploy:success', function () {
162
    info('successfully deployed!');
163
})
164
    ->shallow()
165 3
    ->hidden();
166 8
167 8
168 8
/**
169
 * Deploy failure
170
 */
171
task('deploy:failed', function () {
172
})->hidden();
173
174
fail('deploy', 'deploy:failed');
175 8
176
/**
177 8
 * Follow latest application logs.
178
 */
179
desc('Follow latest application logs.');
180
task('logs', function () {
181
    if (!has('log_files')) {
182 8
        warning("Please, specify \"log_files\" option.");
183
        return;
184
    }
185
186
    if (output()->getVerbosity() === Output::VERBOSITY_NORMAL) {
187
        output()->setVerbosity(Output::VERBOSITY_VERBOSE);
188
    }
189
    cd('{{deploy_path}}/current');
190
    run('tail -f {{log_files}}');
191
});
192