@@ -68,52 +68,6 @@ def load_json_from_response(resp):
68
68
print ("Refusing to decode " + str (type (content )) + " to str" )
69
69
return json .loads (content_str )
70
70
71
- def validate_maintainers (repo , github_token ):
72
- # type: (str, str) -> None
73
- '''Ensure all maintainers are assignable on a GitHub repo'''
74
- next_link_re = re .compile (r'<([^>]+)>; rel="next"' )
75
-
76
- # Load the list of assignable people in the GitHub repo
77
- assignable = [] # type: typing.List[str]
78
- url = 'https://api.github.com/repos/' \
79
- + '%s/collaborators?per_page=100' % repo # type: typing.Optional[str]
80
- while url is not None :
81
- response = urllib2 .urlopen (urllib2 .Request (url , headers = {
82
- 'Authorization' : 'token ' + github_token ,
83
- # Properly load nested teams.
84
- 'Accept' : 'application/vnd.github.hellcat-preview+json' ,
85
- }))
86
- assignable .extend (user ['login' ] for user in load_json_from_response (response ))
87
- # Load the next page if available
88
- url = None
89
- link_header = response .headers .get ('Link' )
90
- if link_header :
91
- matches = next_link_re .match (link_header )
92
- if matches is not None :
93
- url = matches .group (1 )
94
-
95
- errors = False
96
- for tool , maintainers in MAINTAINERS .items ():
97
- for maintainer in maintainers :
98
- if maintainer not in assignable :
99
- errors = True
100
- print (
101
- "error: %s maintainer @%s is not assignable in the %s repo"
102
- % (tool , maintainer , repo ),
103
- )
104
-
105
- if errors :
106
- print ()
107
- print (" To be assignable, a person needs to be explicitly listed as a" )
108
- print (" collaborator in the repository settings. The simple way to" )
109
- print (" fix this is to ask someone with 'admin' privileges on the repo" )
110
- print (" to add the person or whole team as a collaborator with 'read'" )
111
- print (" privileges. Those privileges don't grant any extra permissions" )
112
- print (" so it's safe to apply them." )
113
- print ()
114
- print ("The build will fail due to this." )
115
- exit (1 )
116
-
117
71
118
72
def read_current_status (current_commit , path ):
119
73
# type: (str, str) -> typing.Mapping[str, typing.Any]
@@ -280,21 +234,6 @@ def update_latest(
280
234
try :
281
235
if __name__ != '__main__' :
282
236
exit (0 )
283
- repo = os .environ .get ('TOOLSTATE_VALIDATE_MAINTAINERS_REPO' )
284
- if repo :
285
- github_token = os .environ .get ('TOOLSTATE_REPO_ACCESS_TOKEN' )
286
- if github_token :
287
- # FIXME: This is currently broken. Starting on 2021-09-15, GitHub
288
- # seems to have changed it so that to list the collaborators
289
- # requires admin permissions. I think this will probably just need
290
- # to be removed since we are probably not going to use an admin
291
- # token, and I don't see another way to do this.
292
- print ('maintainer validation disabled' )
293
- # validate_maintainers(repo, github_token)
294
- else :
295
- print ('skipping toolstate maintainers validation since no GitHub token is present' )
296
- # When validating maintainers don't run the full script.
297
- exit (0 )
298
237
299
238
cur_commit = sys .argv [1 ]
300
239
cur_datetime = datetime .datetime .utcnow ().strftime ('%Y-%m-%dT%H:%M:%SZ' )
0 commit comments