Skip to content

Commit 2867c42

Browse files
authored
Only backport if the newly added label is the 'needs backport' label. (GH-36)
Fixes python/miss-islington#35
1 parent b1e1128 commit 2867c42

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

backport/backport_pr.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ async def backport_pr(event, gh, *args, **kwargs):
2323

2424
gh_issue = await gh.getitem(event.data['repository']['issues_url'],
2525
{'number': f"{event.data['pull_request']['number']}"})
26-
27-
pr_labels = await gh.getitem(gh_issue['labels_url'])
26+
pr_labels = []
27+
if event.data['action'] == 'labeled':
28+
pr_labels = [event.data["label"]]
29+
else:
30+
pr_labels = await gh.getitem(gh_issue['labels_url'])
2831
branches = [label['name'].split()[-1]
2932
for label in pr_labels
3033
if label['name'].startswith("needs backport to")]

0 commit comments

Comments
 (0)