Skip to content

Commit b7dd472

Browse files
authored
Skip builds on ci:skip or documentation labels (#436)
1 parent 3291dfe commit b7dd472

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ci-matrix.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from packaging.version import Version
1515

1616
CI_TARGETS_YAML = "ci-targets.yaml"
17+
CI_SKIP_LABELS = ["ci:skip", "documentation"]
1718

1819

1920
def meets_conditional_version(version: str, min_version: str) -> bool:
@@ -31,12 +32,20 @@ def parse_labels(labels: Optional[str]) -> dict[str, set[str]]:
3132
"build": set(),
3233
"arch": set(),
3334
"libc": set(),
35+
"directives": set(),
3436
}
3537

3638
for label in labels.split(","):
3739
label = label.strip()
40+
41+
# Handle special directive labels
42+
if label in CI_SKIP_LABELS:
43+
result["directives"].add("skip")
44+
continue
45+
3846
if not label or ":" not in label:
3947
continue
48+
4049
category, value = label.split(":", 1)
4150
if category in result:
4251
result[category].add(value)
@@ -46,6 +55,9 @@ def parse_labels(labels: Optional[str]) -> dict[str, set[str]]:
4655

4756
def should_include_entry(entry: dict[str, str], filters: dict[str, set[str]]) -> bool:
4857
"""Check if an entry satisfies the label filters."""
58+
if filters.get("directives") and "skip" in filters["directives"]:
59+
return False
60+
4961
if filters.get("platform") and entry["platform"] not in filters["platform"]:
5062
return False
5163

0 commit comments

Comments
 (0)