Skip to content

Commit 352d431

Browse files
committed
Fix GitHub authentication and self-update
1 parent b000d0f commit 352d431

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

public/webhooks/github.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function parseReleaseBody(string $body, string $user, string $repo): string
114114
}, $body);
115115

116116
$github_client = new Client();
117-
$github_client->authenticate(getenv('TG_GITHUB_AUTH_USER'), getenv('TG_GITHUB_AUTH_TOKEN'), Client::AUTH_ACCESS_TOKEN);
117+
$github_client->authenticate(getenv('TG_GITHUB_AUTH_USER'), getenv('TG_GITHUB_AUTH_TOKEN'), Client::AUTH_CLIENT_ID);
118118
$github_client->addCache(new Pool(new MySQL(
119119
new PDO('mysql:dbname=' . getenv('TG_DB_DATABASE') . ';host=' . getenv('TG_DB_HOST'), getenv('TG_DB_USER'), getenv('TG_DB_PASSWORD'))
120120
)));
@@ -131,7 +131,7 @@ function parseReleaseBody(string $body, string $user, string $repo): string
131131
/** @var Issue $issue */
132132
$issue = $github_client->issue()->show($user, $repo, $id);
133133
return "[{$text}]({$issue['html_url']})";
134-
} catch (Throwable $e) {
134+
} catch (Throwable) {
135135
// Silently ignore.
136136
}
137137

@@ -140,7 +140,7 @@ function parseReleaseBody(string $body, string $user, string $repo): string
140140
/** @var PullRequest $pr */
141141
$pr = $github_client->pr()->show($user, $repo, $id);
142142
return "[{$text}]({$pr['html_url']})";
143-
} catch (Throwable $e) {
143+
} catch (Throwable) {
144144
// Silently ignore.
145145
}
146146

@@ -173,7 +173,7 @@ function sendTelegramMessage(string $chat_id, string $text): ?ServerResponse
173173
return Request::sendMessage(compact('chat_id', 'text', 'parse_mode'));
174174
} catch (TelegramException $e) {
175175
TelegramLog::error($e->getMessage());
176-
} catch (Throwable $e) {
176+
} catch (Throwable) {
177177
// Silently ignore.
178178
}
179179

@@ -185,10 +185,10 @@ function sendTelegramMessage(string $chat_id, string $text): ?ServerResponse
185185
*/
186186
function pullLatestAndUpdate(): void
187187
{
188-
exec('sudo -u www-data /usr/bin/git stash');
189-
exec('sudo -u www-data /usr/bin/git fetch');
190-
exec('sudo -u www-data /usr/bin/git reset --hard');
191-
exec('sudo -u www-data /usr/bin/git rebase');
192-
exec('sudo -u www-data /usr/bin/git pull');
193-
exec('sudo -u www-data /usr/local/bin/composer install --no-dev');
188+
exec('/usr/bin/git stash');
189+
exec('/usr/bin/git fetch');
190+
exec('/usr/bin/git reset --hard');
191+
exec('/usr/bin/git rebase');
192+
exec('/usr/bin/git pull');
193+
exec('/usr/local/bin/composer install --no-dev');
194194
}

0 commit comments

Comments
 (0)