Skip to content

Commit

Permalink
Only backport if the newly added label is the 'needs backport' label. (
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariatta authored Oct 17, 2017
1 parent b1e1128 commit 2867c42
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backport/backport_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ async def backport_pr(event, gh, *args, **kwargs):

gh_issue = await gh.getitem(event.data['repository']['issues_url'],
{'number': f"{event.data['pull_request']['number']}"})

pr_labels = await gh.getitem(gh_issue['labels_url'])
pr_labels = []
if event.data['action'] == 'labeled':
pr_labels = [event.data["label"]]
else:
pr_labels = await gh.getitem(gh_issue['labels_url'])
branches = [label['name'].split()[-1]
for label in pr_labels
if label['name'].startswith("needs backport to")]
Expand Down

0 comments on commit 2867c42

Please sign in to comment.