This is an automated email from the ASF dual-hosted git repository.
diwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new d1d87295688 [Chore](GA)Use github's codeowner to implement maintainer
review (#36852)
d1d87295688 is described below
commit d1d872956883d537540317741757908ad9f7e0e7
Author: Calvin Kirs <[email protected]>
AuthorDate: Wed Jun 26 14:59:19 2024 +0800
[Chore](GA)Use github's codeowner to implement maintainer review (#36852)
## Proposed changes
Compared with the previous method, the contributor experience is better
through Github's ready-made method
FYI
https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
---
.asf.yaml | 1 +
.github/CODEOWNERS | 18 +++++++++++++++++
tools/maintainers/check_review.py | 40 ++++----------------------------------
tools/maintainers/maintainers.json | 20 -------------------
4 files changed, 23 insertions(+), 56 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index 61fb7e0346d..83a80db5ff6 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -69,6 +69,7 @@ github:
required_pull_request_reviews:
dismiss_stale_reviews: true
+ require_code_owner_reviews: true
required_approving_review_count: 1
branch-1.1-lts:
required_status_checks:
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 00000000000..15b12fc843e
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+be/src/io/* @platoneko @gavinchou @dataroaring
+fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java @dataroaring
@CalvinKirs @morningman
diff --git a/tools/maintainers/check_review.py
b/tools/maintainers/check_review.py
index 755b6de1c59..728bb8c0a33 100644
--- a/tools/maintainers/check_review.py
+++ b/tools/maintainers/check_review.py
@@ -20,13 +20,12 @@ import json
import match
import sys
-def check_review_pass(pr_num, maintainers_file, token):
+def check_review_pass(pr_num, token):
"""
Checks if all necessary files have been reviewed by maintainers.
Args:
pr_num (int): PR number.
- maintainers_file (str): Path to maintainers.json.
token (str): GitHub token.
Returns:
@@ -46,50 +45,19 @@ def check_review_pass(pr_num, maintainers_file, token):
# Create a list of reviewers who have approved
approves = [reviewer for reviewer, status in latest_statuses.items() if
status == 'APPROVED']
-
- # Get list of changed files
- response =
requests.get(f"https://api.github.com/repos/apache/doris/pulls/{pr_num}/files",
headers=headers)
- file_changes = response.json()
- file_change_names = [file['filename'] for file in file_changes]
-
- # Read maintainers.json
- with open(maintainers_file) as f:
- data = json.load(f)
- need_maintainers_review_path = [item['path'] for item in data['paths']]
-
- # Check if each path's files have been reviewed by a maintainer
- has_maintainer_review = True
- for file in file_change_names:
- path_found = False
- for path_item in data['paths']:
- path = path_item['path']
- maintainers = path_item['maintainers']
-
- if match.match(file, path):
- path_found = True
- if maintainers:
- if not any(maintainer in approves for maintainer in
maintainers):
- has_maintainer_review = False
- break
- else:
- continue
-
- if not path_found:
- continue
print(approves)
if len(approves) < 2:
print("PR has not been approved by at least 2 reviewers")
exit(1)
-
- return has_maintainer_review
+ else:
+ return True
if __name__ == "__main__":
pr_num = sys.argv[1]
token = sys.argv[2]
- maintainers_file = 'tools/maintainers/maintainers.json' # Adjust path if
needed
- if check_review_pass(pr_num, maintainers_file, token):
+ if check_review_pass(pr_num, token):
print("Thanks for your contribution to Doris.")
else:
print("PR has file changes that need to be reviewed by maintainers.")
diff --git a/tools/maintainers/maintainers.json
b/tools/maintainers/maintainers.json
deleted file mode 100644
index d0bfad2f81c..00000000000
--- a/tools/maintainers/maintainers.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "paths":[
- {
- "path":"be/src/io/*",
- "maintainers": [
- "platoneko",
- "gavinchou",
- "dataroaring"
- ]
- },
- {
- "path": "fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java",
- "maintainers": [
- "CalvinKirs",
- "morningman",
- "dataroaring"
- ]
- }
- ]
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]