Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr helper debug #10768

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr_helper.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: PR helper
on:
pull_request_target:
pull_request:
types: [opened, reopened]
branches:
- master
Expand Down
28 changes: 19 additions & 9 deletions infra/pr_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ def main():

# Bypasses PRs of the internal members.
if github.is_author_internal_member():
save_env(None, None, True)
return
# save_env(None, None, True)
# return
print('debug, disable internal check')

message = ''
is_ready_for_merge = True
Expand Down Expand Up @@ -158,6 +159,7 @@ def __init__(self):
'Authorization': f'Bearer {self._token}',
'X-GitHub-Api-Version': '2022-11-28'
}
self._maintainers = set()
os.environ['GITHUB_AUTH_TOKEN'] = self._token

def get_pr_author(self):
Expand Down Expand Up @@ -244,6 +246,8 @@ def get_past_contributors(self, project_path):

login = commit['author']['login']
verified = commit['commit']['verification']['verified']
if login in self._maintainers:
continue
if login not in contributors:
contributors[login] = verified
if verified:
Expand All @@ -257,19 +261,25 @@ def get_past_contributors(self, project_path):

return all_contributors

def is_author_internal_member(self):
"""Returns if the author is an internal member."""
def get_maintainers(self):
"""Get a list of internal members."""
if self._maintainers:
return self._maintainers

response = requests.get(f'{BASE_URL}/contents/infra/MAINTAINERS.csv',
headers=self._headers)
if not response.ok:
return False

maintainers = base64.b64decode(response.json()['content']).decode('UTF-8')
for line in maintainers.split(os.linesep):
if self._pr_author == line.split(',')[2]:
return True
maintainers_file = base64.b64decode(
response.json()['content']).decode('UTF-8')
for line in maintainers_file.split(os.linesep):
self._maintainers.add(line.split(',')[2])
return self._maintainers

return False
def is_author_internal_member(self):
"""Returns if the author is an internal member."""
return self._pr_author in self.get_maintainers()

def has_author_modified_project(self, project_path):
"""Checks if the author has modified this project before."""
Expand Down
2 changes: 1 addition & 1 deletion projects/cpython3/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
################################################################################

# Ignore memory leaks from python scripts invoked in the build
# Ignore memory leaks from python scripts invoked in the build add comment
export ASAN_OPTIONS="detect_leaks=0"
export MSAN_OPTIONS="halt_on_error=0:exitcode=0:report_umrs=0"

Expand Down
Loading