Skip to content

Commit 5dbf050

Browse files
Merge pull request #97 from TheDragonCode/1.x
Added ignoring mentions from Dependabot
2 parents 519b7b6 + 1b8263d commit 5dbf050

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

app/Data/ItemData.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66

77
class ItemData extends Data
88
{
9-
public bool $isOpen;
9+
public ?int $ownerId = null;
1010

11-
public bool $isMerged;
11+
public bool $isOpen = false;
12+
13+
public bool $isMerged = true;
1214

1315
public function __construct(?array $data)
1416
{
1517
if (is_null($data)) {
16-
$this->isOpen = false;
17-
$this->isMerged = true;
18-
1918
return;
2019
}
2120

21+
$this->ownerId = $this->get($data, 'user.id');
22+
2223
$this->isOpen = $this->get($data, 'state') === 'open';
2324
$this->isMerged = (bool) $this->get($data, 'merged');
2425
}

app/Services/GitHub.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ protected function shouldSkip(NotificationData $notification, ItemData $item): b
181181
return true;
182182
}
183183

184-
if ($this->exceptMentions && $notification->reason === 'mention') {
184+
if ($this->exceptMentions && $notification->reason === 'mention' && $this->isNotDependabot($item)) {
185185
return true;
186186
}
187187

@@ -216,4 +216,9 @@ protected function detected(int $count): void
216216

217217
Output::info("unread $pluralized detected", $count);
218218
}
219+
220+
protected function isNotDependabot(ItemData $item): bool
221+
{
222+
return $item->ownerId !== config('bots.dependabot');
223+
}
219224
}

config/bots.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
'dependabot' => 49699333,
5+
];

0 commit comments

Comments
 (0)