tools: owners: reduce notify spam from Jenkins
By default, the Gerrit 'reviewers' API will notify everyone of
the change to add a new reviewer. When adding reviewers automatically
from Jenkins this can cause quite a bit of spam. Adjust the 'notify'
fields of the API call so that only the newly-added reviewer is
notified.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib992284918145a31c9ff749737b3ae09f4d5ef0e
diff --git a/tools/owners b/tools/owners
index d35fe5f..c5a9736 100755
--- a/tools/owners
+++ b/tools/owners
@@ -122,10 +122,21 @@
# Print as Gerrit Add Reviewers POST format.
# https://gerrit.openbmc.org/Documentation/rest-api-changes.html#add-reviewer
else:
+
+ def review_js(reviewer: str, state: str) -> str:
+ return json.dumps(
+ {
+ "reviewer": reviewer,
+ "state": state,
+ "notify": "NONE",
+ "notify_details": {"TO": {"accounts": [reviewer]}},
+ }
+ )
+
for o in sorted(matcher.owners):
- print(json.dumps({"reviewer": o, "state": "REVIEWER"}))
+ print(review_js(o, "REVIEWER"))
for r in sorted(matcher.reviewers):
- print(json.dumps({"reviewer": r, "state": "CC"}))
+ print(review_js(r, "CC"))
def main() -> None:
@@ -141,7 +152,7 @@
parser_reviewers.add_argument(
"--push-args",
default=False,
- action='store_true',
+ action="store_true",
help="Format as git push options",
)
parser_reviewers.add_argument(