Skip to content

Commit

Permalink
Automatically fill zube teams on backports if available (elastic#18924)
Browse files Browse the repository at this point in the history
botelastic adds the needs_team label if a PR doesn't have a zube team label, this
adds an additional manual step to backport PRs. This change adds the team labels
of the original PRs by default.

(cherry picked from commit ba306cd)
  • Loading branch information
jsoriano committed Jun 10, 2020
1 parent 0b6a7df commit 7eb1431
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dev-tools/cherrypick_pr
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,16 @@ def main():
# add labels
labels = ["backport"]

zube_teams = zube_team_labels(original_pr)
if args.zube_team:
resp = session.get(base + "/labels/Team:"+args.zube_team)
if resp.status_code != 200:
print("Cannot find team label", resp.text)
sys.exit(1)
labels.append("Team:"+args.zube_team)
zube_teams = ["Team:" + args.zube_team]

if len(zube_teams) > 0:
labels += zube_teams
labels.append("[zube]: In Review")
else:
labels.append("review")
Expand Down Expand Up @@ -193,6 +197,13 @@ def get_version(beats_dir):
if match:
return match.group('version')

def zube_team_labels(pr):
teams = []
for label in pr.get('labels', []):
name = label.get('name', '')
if name.startswith('Team:'):
teams.append(name)
return teams

if __name__ == "__main__":
sys.exit(main())

0 comments on commit 7eb1431

Please sign in to comment.