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

Commit

Permalink
Let the label bot respond to additional comments; not just when an is…
Browse files Browse the repository at this point in the history
…sue 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
  • Loading branch information
Jeremy Lewi committed May 3, 2020
1 parent 7a4ddb0 commit 3f698dc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion flask_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def bot():
verify_webhook(request)

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

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

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

# write the issue to the database using ORM
issue_db_obj = Issues(repo=repo,
username=username,
Expand Down

0 comments on commit 3f698dc

Please sign in to comment.