File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff 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+
7582def 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
You can’t perform that action at this time.
0 commit comments