Skip to content

Commit fafd35f

Browse files
committed
Don't log whole webhook message.
Logging the UUID is enough as we can look them on on the Github UI.
1 parent e2b3078 commit fafd35f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cfbot_api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,23 @@ def error_cleanup():
3434
@app.route("/api/github-webhook", methods=["POST"])
3535
def github_webhook():
3636
try:
37+
# This UUID can be found under the Github WebHook settings
38+
# "Recent Deliveries" tab, with all the details and our
39+
# response.
40+
event_uuid = request.headers.get("X-Github-Delivery")
3741
event_type = request.headers.get("X-Github-Event")
3842
event = request.json
39-
logging.info("Github webhook: type = %s, payload = %s", event_type, event)
43+
logging.info("Github webhook: delivery = %s, type = %s", event_uuid, event_type)
4044
if event_type == "workflow_job":
4145
cfbot_github.ingest_workflow_job(conn, event)
4246
conn.commit()
4347
return "OK"
4448
elif event_type == "workflow_run":
45-
# XXX Not used yet...
4649
cfbot_github.ingest_workflow_run(conn, event)
4750
conn.commit()
4851
return "OK"
4952
else:
50-
return "not understood"
53+
return "unhandled event type " + event_type
5154
except:
5255
error_cleanup()
5356
logging.exception("Error processing webhook")

0 commit comments

Comments
 (0)