Skip to content
This repository was archived by the owner on Jun 16, 2021. It is now read-only.

Commit 5523f16

Browse files
committed
Filter bots
1 parent d1aeda7 commit 5523f16

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

github/__init__.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
'renovate',
6161
}
6262

63+
IGNORED_NICK_PARTS = {
64+
'[bot]',
65+
}
66+
6367
app = Flask(__name__)
6468
bot_global = None
6569
flask_started = False
@@ -168,6 +172,9 @@ def handle_push_event(data):
168172
return
169173
# Filter bad words
170174
for commit in data['commits']:
175+
for k in IGNORED_NICK_PARTS:
176+
if k in commit['author']['name']:
177+
return
171178
for k in IGNORED_KEYWORDS:
172179
if k in commit['message']:
173180
return
@@ -220,6 +227,10 @@ def handle_unimplemented_event(data, event):
220227

221228

222229
def handle_create_event(data):
230+
# Filter bad words
231+
for k in IGNORED_NICK_PARTS:
232+
if k in data['sender']['login']:
233+
return
223234
ref_type = data['ref_type']
224235
if ref_type == 'branch':
225236
bot_say("{} Branch {}{}{}/{} created by {}".format(COLOR_PREFIX,
@@ -259,7 +270,7 @@ def handle_delete_event(data):
259270

260271
def handle_pull_request_event(data):
261272
# Filter bad words
262-
for k in IGNORED_KEYWORDS:
273+
for k in IGNORED_NICK_PARTS:
263274
if k in data['pull_request']['user']['login']:
264275
return
265276
url = github_shortify(data['pull_request']['html_url'])

0 commit comments

Comments
 (0)