Skip to content
This repository was archived by the owner on Dec 9, 2022. It is now read-only.

Commit 3f698dc

Browse files
author
Jeremy Lewi
committed
Let the label bot respond to additional comments; not just when an issue is opened.
* See kubeflow/code-intelligence#133 we want to allow the label bot to respond after additional comments on an issue and take those comments into account. This is because additional comments on the issue might provide more data pointing at how the issue should be labeled. * We only do this for issues that are forwarded to a pubsub backend and using the newer code for label prediction. related to kubeflow/code-intelligence#133
1 parent 7a4ddb0 commit 3f698dc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

flask_app/app.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def bot():
123123
verify_webhook(request)
124124

125125
# Check if payload corresponds to an issue being opened
126-
if 'action' not in request.json or request.json['action'] != 'opened' or 'issue' not in request.json:
126+
if 'issue' not in request.json:
127127
logging.warning("Event is not for an issue with action opened.")
128128
return 'ok'
129129

@@ -143,6 +143,9 @@ def bot():
143143
logging.info(f"Recieved {username}/{repo}#{issue_num}")
144144
try:
145145
# forward some issues of specific repos and select by their given forwarded proportion
146+
# TODO(jlewi): We could probably simplify this because at this point
147+
# for any repo/org that we are forwarding the issues we should probably
148+
# always forward the issues.
146149
forward_probability = None
147150
repo_spec = f'{username}/{repo}'
148151
if username in forwarded_repos.get("orgs", {}):
@@ -167,6 +170,11 @@ def bot():
167170
f"{username}/{repo}#{issue_num}\n Exception: {e}\n"
168171
f"{traceback.format_exc()}")
169172

173+
# Check if payload corresponds to an issue being opened
174+
if 'action' not in request.json or request.json['action'] != 'opened':
175+
logging.warning("Event is not for an issue with action opened.")
176+
return 'ok'
177+
170178
# write the issue to the database using ORM
171179
issue_db_obj = Issues(repo=repo,
172180
username=username,

0 commit comments

Comments
 (0)