From 039ef04535b4fc868cdae70423caf50ad5772db4 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 11 Jun 2020 18:05:30 +0200 Subject: [PATCH] Automatically fill zube teams on backports if available (#18924) (#19100) 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 ba306cdca9461c5e955fa6b98ae747550d5b113c) --- dev-tools/cherrypick_pr | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dev-tools/cherrypick_pr b/dev-tools/cherrypick_pr index f49dd0892b1..dbac7ec3472 100755 --- a/dev-tools/cherrypick_pr +++ b/dev-tools/cherrypick_pr @@ -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") @@ -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())