Skip to content

Commit 36b433e

Browse files
committed
restore skipping jobs from pr body
1 parent e00145a commit 36b433e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

ci/jobs/scripts/workflow_hooks/filter_job.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import re
2+
from functools import lru_cache
3+
14
from ci.defs.defs import JobNames
25
from ci.defs.job_configs import JobConfigs
36
from ci.jobs.scripts.workflow_hooks.new_tests_check import (
@@ -49,6 +52,15 @@ def only_docs(changed_files):
4952
_info_cache = None
5053

5154

55+
@lru_cache
56+
def get_ci_exclude_tags(pr_body):
57+
pattern = r"(#|- \[x\] +<!---ci_exclude_)([|\w]+)"
58+
matches = []
59+
for match in re.findall(pattern, pr_body):
60+
matches.extend(match[-1].split("|"))
61+
return matches
62+
63+
5264
def should_skip_job(job_name):
5365
global _info_cache
5466
if _info_cache is None:
@@ -157,4 +169,9 @@ def should_skip_job(job_name):
157169
):
158170
return True, "Skipped, not labeled with 'pr-performance'"
159171

172+
ci_exclude_tags = get_ci_exclude_tags(_info_cache.pr_body)
173+
for tag in ci_exclude_tags:
174+
if tag in job_name:
175+
return True, f"Skipped, job name includes excluded tag '{tag}'"
176+
160177
return False, ""

0 commit comments

Comments
 (0)