You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gi...@apache.org on 2024/08/23 17:04:15 UTC
(kafka-merge-queue-sandbox) branch gh-readonly-queue/main/pr-40-7ca3a755b995566f1698c851fa1b5eeba7dc1815 created (now aa75c10)
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a change to branch gh-readonly-queue/main/pr-40-7ca3a755b995566f1698c851fa1b5eeba7dc1815
in repository https://gitbox.apache.org/repos/asf/kafka-merge-queue-sandbox.git
at aa75c10 load mapping of gh id to ASF id (#40)
This branch includes the following new commits:
new aa75c10 load mapping of gh id to ASF id (#40)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(kafka-merge-queue-sandbox) 01/01: load mapping of gh id to ASF id (#40)
Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch gh-readonly-queue/main/pr-40-7ca3a755b995566f1698c851fa1b5eeba7dc1815
in repository https://gitbox.apache.org/repos/asf/kafka-merge-queue-sandbox.git
commit aa75c1048fb3fd56329db0ff550863f9f4a863bf
Author: David Arthur <mu...@gmail.com>
AuthorDate: Fri Aug 23 13:03:52 2024 -0400
load mapping of gh id to ASF id (#40)
---
webhook-receive.py | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/webhook-receive.py b/webhook-receive.py
index ee0ed61..f251ef3 100644
--- a/webhook-receive.py
+++ b/webhook-receive.py
@@ -1,7 +1,15 @@
from flask import Flask, request, jsonify
+from yaml import load, dump
+from yaml import Loader, Dumper
app = Flask(__name__)
+with open("config.yml") as fp:
+ config = load(fp, Loader=Loader)
+
+gh_user_map = config.get("gh-user-map", {})
+
+
@app.route('/webhook', methods=['POST'])
def webhook_receiver():
payload = request.json
@@ -11,9 +19,10 @@ def webhook_receiver():
if event == "pull_request" and action == "enqueued":
pr_number = payload.get("number")
login = payload.get("sender").get("login")
+ asf_id = gh_user_map.get(login)
pull_request = payload.get("pull_request")
title = pull_request.get("title")
- print(f"User {login} added PR #{pr_number} ({title}) to merge queue.")
+ print(f"User {login} (Apache ID {asf_id}) added PR #{pr_number} ({title}) to merge queue.")
elif event == "pull_request" and action == "dequeued":
pr_number = payload.get("number")
reason = payload.get("reason")
@@ -22,14 +31,16 @@ def webhook_receiver():
merge_commit_sha = pull_request.get("merge_commit_sha")
title = pull_request.get("title")
login = payload.get("sender").get("login")
- print(f"User {login} merged PR #{pr_number} ({title}). Merge SHA is {merge_commit_sha}")
+ asf_id = gh_user_map.get(login)
+ print(f"User {login} (Apache ID {asf_id}) merged PR #{pr_number} ({title}). Merge SHA is {merge_commit_sha}")
elif event == "merge_group" and action == "checks_requested":
print("Merge group!!")
merge_group = payload.get("merge_group", {})
login = payload.get("sender").get("login")
+ asf_id = gh_user_map.get(login)
base = merge_group.get("base_sha")
head = merge_group.get("head_sha")
- print(f"User {login} merged commits after {base} up until {head} via merge queue")
+ print(f"User {login} (Apache ID {asf_id}) merged commits after {base} up until {head} via merge queue")
else:
print(f"Received webhook event {event} with action {action}")