Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drive-by clean-ups #264

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions openedx_webhooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ def create_app(config=None):
# attach our blueprints
from .github_views import github_bp
app.register_blueprint(github_bp, url_prefix="/github")
from .jira_views import jira_bp
app.register_blueprint(jira_bp, url_prefix="/jira")
from .ui import ui as ui_blueprint
app.register_blueprint(ui_blueprint)
from .tasks import tasks as tasks_blueprint
Expand Down
14 changes: 6 additions & 8 deletions openedx_webhooks/github_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,13 @@ def handle_pull_request_event(event):
def handle_comment_event(event):
"""Handle a webhook event about a comment."""

# When the bot comments on a pull request, it causes an event, which gets
# sent to webhooks, including us. We don't have to do anything for our
# own comment events.
who = event.get("sender", {}).get("login", "someone")
if who == get_bot_username():
return "No thanks", 202

match event:
case {"sender": {"login": who}} if who == get_bot_username():
# When the bot comments on a pull request, it causes an event, which
# gets sent to webhooks, including us. We don't have to do anything
# for our own comment events.
pass

case {"issue": {"pull_request": _}}:
# The comment is on a pull request. Re-shape the data to conform to
# a pull request reported by a pull request event, and fire
Expand All @@ -133,7 +132,6 @@ def handle_comment_event(event):
case _:
pass

# Soon to come: handling comments.
return "No thanks", 202


Expand Down
Loading