Skip to content

Commit 313c07b

Browse files
committed
Use proper released action to trigger update notification
1 parent 28eeed3 commit 313c07b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
99
### Deprecated
1010
### Removed
1111
### Fixed
12+
- Trigger the release note for `released` action instead of `published`.
1213
### Security
1314

1415
## [0.13.0] - 2022-03-24

public/webhooks/github.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Github\Api\Issue;
1515
use Github\Api\PullRequest;
16+
use Github\AuthMethod;
1617
use Github\Client;
1718
use Longman\TelegramBot\Entities\ServerResponse;
1819
use Longman\TelegramBot\Exception\TelegramException;
@@ -79,7 +80,7 @@ function handleRelease(array $data): void
7980
$release = $data['release'];
8081
$action = $data['action'];
8182

82-
if ($action === 'published' && !$release['draft'] && !$release['prerelease']) {
83+
if ($action === 'released' && !$release['draft'] && !$release['prerelease']) {
8384
$author = $release['author']['login'];
8485
$author_url = $release['author']['html_url'];
8586
$tag = $release['tag_name'];
@@ -116,7 +117,7 @@ function parseReleaseBody(string $body, string $user, string $repo): string
116117
}, $body);
117118

118119
$github_client = new Client();
119-
$github_client->authenticate(getenv('TG_GITHUB_AUTH_USER'), getenv('TG_GITHUB_AUTH_TOKEN'), Client::AUTH_CLIENT_ID);
120+
$github_client->authenticate(getenv('TG_GITHUB_AUTH_USER'), getenv('TG_GITHUB_AUTH_TOKEN'), AuthMethod::CLIENT_ID);
120121
$github_client->addCache(new Pool(new MySQL(
121122
new PDO('mysql:dbname=' . getenv('TG_DB_DATABASE') . ';host=' . getenv('TG_DB_HOST'), getenv('TG_DB_USER'), getenv('TG_DB_PASSWORD'))
122123
)));

0 commit comments

Comments
 (0)