Skip to content

Commit 0eabbd5

Browse files
authored
Fix flaky test detection tool labels (#33709)
1 parent 9761271 commit 0eabbd5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.test-infra/tools/flaky_test_detection.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ def get_workflow_issues(issues):
7272
return workflows
7373

7474

75+
def ensure_labels_exist(repo, labels):
76+
existing_labels = {label.name for label in repo.get_labels()}
77+
for label in labels:
78+
if label not in existing_labels:
79+
repo.create_label(name=label, color="ededed")
80+
81+
7582
def create_github_issue(repo, alert):
7683
github_workflow_failing_runs_url = f"https://github.com/{GIT_ORG}/beam/actions/{alert.workflow_filename}?query=is%3Afailure+branch%3Amaster"
7784
title = f"The {alert.workflow_name} job is flaky"
@@ -92,6 +99,7 @@ def create_github_issue(repo, alert):
9299
if READ_ONLY == "true":
93100
print("READ_ONLY is true, not creating issue")
94101
else:
102+
ensure_labels_exist(repo, labels)
95103
repo.create_issue(title=title, body=body, labels=labels)
96104

97105

0 commit comments

Comments
 (0)