Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically fill zube teams on backports if available #18924

Merged
merged 1 commit into from
Jun 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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())