Skip to content

Commit 4ea65be

Browse files
author
Ned Batchelder
committed
feat!: removed any knowledge of who is a core contributor. #227
1 parent cfc21cb commit 4ea65be

File tree

9 files changed

+9
-199
lines changed

9 files changed

+9
-199
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. A new scriv changelog fragment.
2+
3+
- Removed: any understanding of who is a core contributor. The bot no longer
4+
makes comments or labels particular to core contributors. `Issue 227`_.
5+
6+
.. _issue 227: https://github.com/openedx/openedx-webhooks/issues/227

docs/details.rst

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ handled:
3535
- If the title of the pull request indicates this is a blended project (with
3636
"[BD-XXX]" in the title), then this is a blended pull request.
3737

38-
- The author is checked for core committer status in the repo. If so, this is
39-
a core commiter pull request.
40-
4138
- Otherwise, this is a regular pull request.
4239

4340
Additionally, if the pull request is in draft status, or has "WIP" in the
@@ -68,8 +65,6 @@ Now we can decide what to do:
6865

6966
- Initial Jira status:
7067

71-
- Core committer pull requests get "Waiting on Author".
72-
7368
- Blended pull requests get "Needs Triage".
7469

7570
- For regular pull requests, if the author doesn't have a signed CLA, the
@@ -87,17 +82,13 @@ be changed.
8782
- Blended pull requests get "blended" applied as a GitHub label and Jira
8883
label.
8984

90-
- Core committer pull requests get "core-commiter" as a Jira label and
91-
"open-source-contribution" as a GitHub label.
92-
9385
- Regular pull requests just get "open-source-contribution" as a GitHub label.
9486

9587
- The initial Jira status is set as a GitHub label on the pull request.
9688

9789
- Initial bot comment:
9890

99-
- Each kind of pull request (blended, core committer, and regular) gets
100-
different comments.
91+
- Each kind of pull request (blended and regular) gets different comments.
10192

10293
- If the user doesn't have a signed CLA, the bot adds a paragraph about
10394
needing to sign one.
@@ -143,9 +134,6 @@ When a pull request is closed
143134
The bot leaves a comment asking the author to complete a survey about the pull
144135
request.
145136

146-
If the pull request was a core committer PR, the bot leaves a comment pinging
147-
the committer's edX champions, to help them stay current.
148-
149137

150138
When a pull request is re-opened
151139
--------------------------------

openedx_webhooks/bot_comments.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class BotComment(Enum):
2828
WELCOME = auto()
2929
WELCOME_CLOSED = auto()
3030
NEED_CLA = auto()
31-
CORE_COMMITTER = auto()
3231
BLENDED = auto()
3332
END_OF_WIP = auto()
3433
SURVEY = auto()
@@ -47,9 +46,6 @@ class BotComment(Enum):
4746
"<!-- comment:no_cla -->",
4847
"We can't start reviewing your pull request until you've submitted",
4948
],
50-
BotComment.CORE_COMMITTER: [
51-
"<!-- comment:welcome-core-committer -->",
52-
],
5349
BotComment.BLENDED: [
5450
"<!-- comment:welcome-blended -->",
5551
],
@@ -72,7 +68,6 @@ class BotComment(Enum):
7268
BotComment.WELCOME_CLOSED,
7369
BotComment.NEED_CLA,
7470
BotComment.BLENDED,
75-
BotComment.CORE_COMMITTER,
7671
BotComment.END_OF_WIP,
7772
BotComment.NO_CONTRIBUTIONS,
7873
}
@@ -119,20 +114,6 @@ def github_community_pr_comment_closed(pull_request: PrDict, issue_key: str, **k
119114
)
120115

121116

122-
def github_committer_pr_comment(pull_request: PrDict, issue_key: str, **kwargs) -> str:
123-
"""
124-
Create the body of the comment for new pull requests from core committers.
125-
"""
126-
return render_template(
127-
"github_committer_pr_comment.md.j2",
128-
user=pull_request["user"]["login"],
129-
issue_key=issue_key,
130-
is_draft=is_draft_pull_request(pull_request),
131-
jira_server=settings.JIRA_SERVER,
132-
**kwargs
133-
)
134-
135-
136117
def github_blended_pr_comment(
137118
pull_request: PrDict,
138119
issue_key: str,

openedx_webhooks/info.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -204,38 +204,6 @@ def _pr_author_data(pull_request: PrDict) -> Optional[Dict]:
204204
return people.get(author)
205205

206206

207-
def is_committer_pull_request(pull_request: PrDict) -> bool:
208-
"""
209-
Was this pull request created by a core committer for this repo
210-
or branch?
211-
"""
212-
person = _pr_author_data(pull_request)
213-
if person is None:
214-
return False
215-
if "committer" not in person:
216-
return False
217-
218-
repo = pull_request["base"]["repo"]["full_name"]
219-
org = repo.partition("/")[0]
220-
branch = pull_request["base"]["ref"]
221-
commit_rights = person["committer"]
222-
if not commit_rights:
223-
return False
224-
if "orgs" in commit_rights:
225-
if org in commit_rights["orgs"]:
226-
return True
227-
if "repos" in commit_rights:
228-
if repo in commit_rights["repos"]:
229-
return True
230-
if "branches" in commit_rights:
231-
for access_branch in commit_rights["branches"]:
232-
if access_branch.endswith("*") and branch.startswith(access_branch[:-1]):
233-
return True
234-
elif branch == access_branch:
235-
return True
236-
return False
237-
238-
239207
NO_CONTRIBUTION_ORGS = {"edx"}
240208

241209
def repo_refuses_contributions(pull_request: PrDict) -> bool:

openedx_webhooks/labels.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919

2020
JIRA_CATEGORY_LABELS = {
2121
"blended",
22-
"core-committer",
2322
}

openedx_webhooks/tasks/pr_tracking.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
extract_data_from_comment,
1919
format_data_for_comment,
2020
github_blended_pr_comment,
21-
github_committer_pr_comment,
2221
github_community_pr_comment,
2322
github_community_pr_comment_closed,
2423
github_end_survey_comment,
@@ -43,7 +42,6 @@
4342
get_jira_issue_key,
4443
get_people_file,
4544
is_bot_pull_request,
46-
is_committer_pull_request,
4745
is_draft_pull_request,
4846
is_internal_pull_request,
4947
is_private_repo_no_cla_pull_request,
@@ -292,12 +290,6 @@ def desired_support_state(pr: PrDict) -> Optional[PrDesiredInfo]:
292290
comment = BotComment.WELCOME_CLOSED
293291
desired.jira_project = jira_project_for_ospr(pr)
294292
desired.github_labels.add("open-source-contribution")
295-
committer = is_committer_pull_request(pr)
296-
if committer:
297-
comment = BotComment.CORE_COMMITTER
298-
desired.jira_labels.add("core-committer")
299-
desired.jira_initial_status = "Waiting on Author"
300-
desired.bot_comments.add(BotComment.CORE_COMMITTER)
301293
desired.bot_comments.add(comment)
302294

303295
assert settings.GITHUB_OSPR_PROJECT, "You must set GITHUB_OSPR_PROJECT"
@@ -613,10 +605,6 @@ def _fix_bot_comment(self, comment_kwargs: Dict) -> None:
613605
if BotComment.SURVEY in self.desired.bot_comments:
614606
self.desired.bot_comments.remove(BotComment.SURVEY)
615607

616-
if BotComment.CORE_COMMITTER in needed_comments:
617-
comment_body += github_committer_pr_comment(self.pr, jira_id, **comment_kwargs)
618-
needed_comments.remove(BotComment.CORE_COMMITTER)
619-
620608
if BotComment.BLENDED in needed_comments:
621609
comment_body += github_blended_pr_comment(
622610
self.pr,

openedx_webhooks/templates/github_committer_pr_comment.md.j2

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/test_info.py

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from openedx_webhooks.info import (
88
get_people_file,
9-
is_committer_pull_request, is_internal_pull_request, is_draft_pull_request,
9+
is_internal_pull_request, is_draft_pull_request,
1010
get_blended_project_id,
1111
)
1212

@@ -59,45 +59,6 @@ def test_left_but_still_a_fan(make_pull_request):
5959
pr = make_pull_request("jarv")
6060
assert not is_internal_pull_request(pr)
6161

62-
def test_org_committers(make_pull_request):
63-
pr = make_pull_request("felipemontoya", repo="openedx/something")
64-
assert not is_internal_pull_request(pr)
65-
assert is_committer_pull_request(pr)
66-
pr = make_pull_request("felipemontoya", repo="edx/something")
67-
assert not is_internal_pull_request(pr)
68-
assert not is_committer_pull_request(pr)
69-
70-
def test_repo_committers(make_pull_request):
71-
pr = make_pull_request("pdpinch", repo="openedx/ccx-keys")
72-
assert not is_internal_pull_request(pr)
73-
assert is_committer_pull_request(pr)
74-
pr = make_pull_request("pdpinch", repo="openedx/edx-platform")
75-
assert not is_internal_pull_request(pr)
76-
assert not is_committer_pull_request(pr)
77-
78-
def test_base_branch_committers(make_pull_request):
79-
pr = make_pull_request(
80-
"hollyhunter",
81-
repo="openedx/fake-release-repo",
82-
ref="open-release/birch.1"
83-
)
84-
assert not is_internal_pull_request(pr)
85-
assert is_committer_pull_request(pr)
86-
pr = make_pull_request(
87-
"hollyhunter",
88-
repo="openedx/fake-release-repo",
89-
ref="master"
90-
)
91-
assert not is_internal_pull_request(pr)
92-
assert not is_committer_pull_request(pr)
93-
pr = make_pull_request(
94-
"pdpinch",
95-
repo="openedx/fake-release-repo",
96-
ref="open-release/birch.1"
97-
)
98-
assert not is_internal_pull_request(pr)
99-
assert not is_committer_pull_request(pr)
100-
10162
def test_current_person_no_institution():
10263
people = get_people_file()
10364
current_person = people["jarv"]

tests/test_pull_request_opened.py

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -242,56 +242,6 @@ def test_psycho_reopening(fake_github, fake_jira):
242242
assert issue.status == status
243243

244244

245-
def test_core_committer_pr_opened(has_jira, fake_github, fake_jira):
246-
pr = fake_github.make_pull_request(user="felipemontoya", owner="openedx", repo="edx-platform")
247-
prj = pr.as_json()
248-
249-
issue_id, anything_happened = pull_request_changed(prj)
250-
251-
assert anything_happened is True
252-
if has_jira:
253-
assert issue_id is not None
254-
assert issue_id.startswith("OSPR-")
255-
256-
# Check the Jira issue that was created.
257-
assert len(fake_jira.issues) == 1
258-
issue = fake_jira.issues[issue_id]
259-
assert issue.contributor_name == "Felipe Montoya"
260-
assert issue.customer == ["EduNEXT"]
261-
assert issue.pr_number == prj["number"]
262-
assert issue.repo == prj["base"]["repo"]["full_name"]
263-
assert issue.url == prj["html_url"]
264-
assert issue.description == prj["body"]
265-
assert issue.issuetype == "Pull Request Review"
266-
assert issue.summary == prj["title"]
267-
assert issue.labels == {"core-committer"}
268-
269-
# Check that the Jira issue was moved to Waiting on Author
270-
assert issue.status == "Waiting on Author"
271-
else:
272-
assert issue_id is None
273-
assert len(fake_jira.issues) == 0
274-
275-
# Check the GitHub comment that was created.
276-
pr_comments = pr.list_comments()
277-
assert len(pr_comments) == 1
278-
body = pr_comments[0].body
279-
check_issue_link_in_markdown(body, issue_id)
280-
assert "Thanks for the pull request, @felipemontoya!" in body
281-
assert is_comment_kind(BotComment.CORE_COMMITTER, body)
282-
assert not is_comment_kind(BotComment.NEED_CLA, body)
283-
284-
# Check the GitHub labels that got applied.
285-
expected_labels = {"open-source-contribution"}
286-
if has_jira:
287-
expected_labels.add("waiting on author")
288-
assert pr.labels == expected_labels
289-
# Check the status check applied to the latest commit.
290-
assert pr.status(CLA_CONTEXT) == CLA_STATUS_GOOD
291-
# It should have been put in the OSPR project.
292-
assert pull_request_projects(pr.as_json()) == {settings.GITHUB_OSPR_PROJECT}
293-
294-
295245
EXAMPLE_PLATFORM_MAP_1_2 = {
296246
"child": {
297247
"id": "14522",
@@ -613,7 +563,7 @@ def test_title_change_but_issue_already_moved(fake_github, fake_jira):
613563
assert get_jira_issue_key(prj) == (True, issue_id)
614564

615565

616-
@pytest.mark.parametrize("pr_type", ["normal", "blended", "committer", "nocla"])
566+
@pytest.mark.parametrize("pr_type", ["normal", "blended", "nocla"])
617567
@pytest.mark.parametrize("jira_got_fiddled", [
618568
pytest.param(False, id="jira:notfiddled"),
619569
pytest.param(True, id="jira:fiddled"),
@@ -642,9 +592,6 @@ def test_draft_pr_opened(pr_type, jira_got_fiddled, has_jira, fake_github, fake_
642592
title2 = "[BD-34] Something good"
643593
initial_status = "Needs Triage"
644594
pr = fake_github.make_pull_request(user="tusbar", title=title1)
645-
elif pr_type == "committer":
646-
initial_status = "Waiting on Author"
647-
pr = fake_github.make_pull_request(user="felipemontoya", owner="openedx", repo="edx-platform", title=title1)
648595
else:
649596
assert pr_type == "nocla"
650597
initial_status = "Community Manager Review"
@@ -668,8 +615,6 @@ def test_draft_pr_opened(pr_type, jira_got_fiddled, has_jira, fake_github, fake_
668615
assert issue.labels == set()
669616
elif pr_type == "blended":
670617
assert issue.labels == {"blended"}
671-
elif pr_type == "committer":
672-
assert issue.labels == {"core-committer"}
673618
else:
674619
assert pr_type == "nocla"
675620
assert issue.labels == set()
@@ -699,8 +644,6 @@ def test_draft_pr_opened(pr_type, jira_got_fiddled, has_jira, fake_github, fake_
699644
assert is_comment_kind(BotComment.WELCOME, body)
700645
elif pr_type == "blended":
701646
assert is_comment_kind(BotComment.BLENDED, body)
702-
elif pr_type == "committer":
703-
assert is_comment_kind(BotComment.CORE_COMMITTER, body)
704647
else:
705648
assert pr_type == "nocla"
706649
assert is_comment_kind(BotComment.NEED_CLA, body)

0 commit comments

Comments
 (0)