Skip to content

Commit eed88df

Browse files
authored
Assign the PR that failed to be backported to the core dev. (#90)
Update the readme indicating that the PR will be assigned to the core dev for follow up.
1 parent c0393de commit eed88df

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

README.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Once the pull request has been merged, `@miss-islington <https://github.com/miss
1717
will prepare the backport PR.
1818

1919
If `@miss-islington <https://github.com/miss-islington>`_ encountered any issue while backporting,
20-
it will leave a comment about it. The PR then needs to be backported manually.
20+
it will leave a comment about it, and the PR will be assigned to the core developer
21+
who merged the PR. The PR then needs to be backported manually.
2122

2223

2324
Merging the Backport PR

miss_islington/tasks.py

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def backport_task(commit_hash, branch, *, issue_number, created_by, merged_by):
4646
cherry_picker {commit_hash} {branch}
4747
```
4848
""")
49+
util.assign_pr_to_core_dev(issue_number, merged_by)
4950
cp = cherry_picker.CherryPicker('origin', commit_hash, [branch],
5051
prefix_commit=False)
5152
try:
@@ -58,6 +59,7 @@ def backport_task(commit_hash, branch, *, issue_number, created_by, merged_by):
5859
cherry_picker {commit_hash} {branch}
5960
```
6061
""")
62+
util.assign_pr_to_core_dev(issue_number, merged_by)
6163
cp.abort_cherry_pick()
6264
except cherry_picker.CherryPickException:
6365
util.comment_on_pr(issue_number,
@@ -67,6 +69,7 @@ def backport_task(commit_hash, branch, *, issue_number, created_by, merged_by):
6769
cherry_picker {commit_hash} {branch}
6870
```
6971
""")
72+
util.assign_pr_to_core_dev(issue_number, merged_by)
7073
cp.abort_cherry_pick()
7174

7275

miss_islington/util.py

+22
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,28 @@ def comment_on_pr(issue_number, message):
2828
print(response.text)
2929

3030

31+
def assign_pr_to_core_dev(issue_number, coredev_login):
32+
"""
33+
Assign the PR to a core dev. Should be done when miss-islington failed
34+
to backport.
35+
"""
36+
request_headers = sansio.create_headers(
37+
"miss-islington",
38+
oauth_token=os.getenv('GH_AUTH'))
39+
edit_issue_url = f"https://api.github.com/repos/python/cpython/issues/{issue_number}"
40+
data = {
41+
"assignees": [coredev_login],
42+
}
43+
response = requests.patch(edit_issue_url,
44+
headers=request_headers,
45+
json=data)
46+
if response.status_code == requests.codes.created:
47+
print(f"Assigned PR {issue_number} to {coredev_login}")
48+
else:
49+
print(response.status_code)
50+
print(response.text)
51+
52+
3153
async def leave_comment(gh, pr_number, message):
3254
"""
3355
Leave a comment on a PR/Issue

0 commit comments

Comments
 (0)