Skip to content

Commit 88f0d35

Browse files
committed
fixes
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
1 parent 0c46c7c commit 88f0d35

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

scripts/check_maintainer_changes.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
#!/usr/bin/env python3
22

3-
import sys
3+
import argparse
44
import os
5+
import sys
6+
57
import yaml
6-
import argparse
78
from github import Github
89

10+
911
def load_areas(filename: str):
10-
with open(filename, "r") as f:
12+
with open(filename) as f:
1113
doc = yaml.safe_load(f)
12-
return {k: v for k, v in doc.items() if isinstance(v, dict) and ("files" in v or "files-regex" in v)}
14+
return {
15+
k: v for k, v in doc.items() if isinstance(v, dict) and ("files" in v or "files-regex" in v)
16+
}
17+
1318

1419
def set_or_empty(d, key):
1520
return set(d.get(key, []) or [])
1621

22+
1723
def check_github_access(usernames, repo_fullname, token):
1824
"""Check if each username has at least Triage access to the repo."""
1925
gh = Github(token)
@@ -29,6 +35,7 @@ def check_github_access(usernames, repo_fullname, token):
2935
missing_access.add(username)
3036
return missing_access
3137

38+
3239
def compare_areas(old, new, repo_fullname=None, token=None):
3340
old_areas = set(old.keys())
3441
new_areas = set(new.keys())
@@ -144,6 +151,10 @@ def compare_areas(old, new, repo_fullname=None, token=None):
144151
print(f" - {u}")
145152
if not missing_maint and not missing_collab:
146153
print("All added maintainers and collaborators have at least triage access.")
154+
else:
155+
print("Some added maintainers or collaborators do not have sufficient access.")
156+
sys.exit(1)
157+
147158

148159
def main():
149160
parser = argparse.ArgumentParser(
@@ -160,5 +171,6 @@ def main():
160171
token = os.environ.get("GITHUB_TOKEN") or args.token
161172
compare_areas(old_areas, new_areas, repo_fullname=args.repo, token=token)
162173

174+
163175
if __name__ == "__main__":
164-
main()
176+
main()

0 commit comments

Comments
 (0)