You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2024/08/23 17:02:18 UTC

(kafka-merge-queue-sandbox) branch yaml created (now 2cc240f)

This is an automated email from the ASF dual-hosted git repository.

davidarthur pushed a change to branch yaml
in repository https://gitbox.apache.org/repos/asf/kafka-merge-queue-sandbox.git


      at 2cc240f  load mapping of gh id to ASF id

This branch includes the following new commits:

     new 2cc240f  load mapping of gh id to ASF id

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

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidarthur pushed a commit to branch yaml
in repository https://gitbox.apache.org/repos/asf/kafka-merge-queue-sandbox.git

commit 2cc240f320831700a91e8771d6c079cdffced465
Author: David Arthur <mu...@gmail.com>
AuthorDate: Fri Aug 23 13:02:06 2024 -0400

    load mapping of gh id to ASF id
---
 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}")