Skip to content

Commit

Permalink
[ci] Remove author check from ping bot (#12788)
Browse files Browse the repository at this point in the history
This has been working fine for a while, this code opens it up so it's
not limited to the authors in #9983.

Co-authored-by: driazati <driazati@users.noreply.github.com>
  • Loading branch information
driazati and driazati authored Sep 15, 2022
1 parent 111a88d commit 5b43c62
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
19 changes: 1 addition & 18 deletions ci/scripts/ping_reviewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ def make_ping_message(pr, reviewers):
parser.add_argument("--wait-time-minutes", required=True, type=int, help="ssh remote to parse")
parser.add_argument("--cutoff-pr-number", default=0, type=int, help="ssh remote to parse")
parser.add_argument("--dry-run", action="store_true", help="don't update GitHub")
parser.add_argument("--allowlist", help="filter by these PR authors")
parser.add_argument("--pr-json", help="(testing) data for testing to use instead of GitHub")
parser.add_argument("--now", help="(testing) custom string for current time")
args = parser.parse_args()
Expand All @@ -208,17 +207,6 @@ def make_ping_message(pr, reviewers):
end="",
)

# [slow rollout]
# This code is here to gate this feature to a limited set of people before
# deploying it for everyone to avoid spamming in the case of bugs or
# ongoing development.
if args.allowlist:
author_allowlist = args.allowlist.split(",")
else:
github = GitHubRepo(token=os.environ["GITHUB_TOKEN"], user=user, repo=repo)
allowlist_issue = github.get("issues/9983")
author_allowlist = set(find_reviewers(allowlist_issue["body"]))

if args.pr_json:
r = json.loads(args.pr_json)
else:
Expand All @@ -242,13 +230,8 @@ def make_ping_message(pr, reviewers):
print(
f"Skipping #{pr['number']} since it's too old ({pr['number']} <= {cutoff_pr_number})"
)
elif pr["author"]["login"] not in author_allowlist:
# [slow rollout]
print(
f"Skipping #{pr['number']} since author {pr['author']['login']} is not in allowlist: {author_allowlist}"
)
else:
print(f"Checking #{pr['number']} since author is in {author_allowlist}")
print(f"Checking #{pr['number']}")
prs_to_check.append(pr)

print(f"Summary: Checking {len(prs_to_check)} of {len(prs)} fetched")
Expand Down
20 changes: 0 additions & 20 deletions tests/python/ci/test_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,24 +548,6 @@ def all_time_keys(time):
},
check="Pinging reviewers ['someone'] on https://github.com/apache/tvm/pull/123",
),
# Check allowlist functionality
allowlist=dict(
pull_request={
"number": 123,
"url": "https://github.com/apache/tvm/pull/123",
"body": "cc @someone",
"isDraft": False,
"author": {"login": "user2"},
"reviews": {"nodes": []},
**all_time_keys("2022-01-18T17:54:19Z"),
"comments": {
"nodes": [
{**all_time_keys("2022-01-19T17:54:19Z"), "bodyText": "abc"},
]
},
},
check="Checking 0 of 1 fetched",
),
# Old comment, ping
old_comment=dict(
pull_request={
Expand Down Expand Up @@ -632,8 +614,6 @@ def test_ping_reviewers(tmpdir_factory, pull_request, check):
"1",
"--cutoff-pr-number",
"5",
"--allowlist",
"user",
"--pr-json",
json.dumps(data),
"--now",
Expand Down

0 comments on commit 5b43c62

Please sign in to comment.