Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
0xWDG committed Jul 13, 2024
1 parent 58917a7 commit c4c0a56
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
41 changes: 41 additions & 0 deletions action/issue-verifiy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

if (
$payload['action'] == 'created' &&
isset($payload['issue']) &&
isset($payload['comment']) &&
(PHP_SAPI !== 'cli' ? $payload['comment']['user']['login'] != $settings['username'] : true)
) {
$PRNumber = $payload['issue']['number'];
$user = $payload['comment']['user']['login'];
$repo = $payload['repository']['full_name'];
$isAdmin = in_array($user, $settings['admins']);
$comment = $payload['comment']['body'] ?? '';

if (
preg_match("/\@" . $settings['username'] . "/", strtolower($payload['comment']['body'] ?? '')) &&
preg_match("/verify/", strtolower($payload['comment']['body'] ?? ''), $matches)
) {
if ($isAdmin) {
foreach (explode("\n", strtolower($comment)) as $line) {

// We are in a blockquote, skip this line.
if (preg_match("/> /", $line)) {
continue;
}

if (preg_match("/verify/", $line)) {
api(
$payload['issue']['url'] . '/labels',
json_encode(
array(
"labels" => array("verified", "bug")
)
),
'PUT'
);
}
}
}
}
}
3 changes: 1 addition & 2 deletions action/pr-accepted-message.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
$user = $payload['pull_request']['user']['login'];
$repo = $payload['repository']['full_name'];
$merged = $payload['pull_request']['merged'] ?? false;

if ($merged) {
if ($merged && $user != "dependabot[bot]") {
// Send a message to Discord
discord("PR [{$repo}](<https://github.com/{$repo}>) [#$PRNumber](<{$payload['pull_request']['html_url']}>) is accepted! Closing message to [{$user}](<https://github.com/{$user}>).");

Expand Down

0 comments on commit c4c0a56

Please sign in to comment.