ci: scope Toolkit workflow-only pull request checks
verify / verify (pull_request) Successful in 12m44s
verify / verify (pull_request) Successful in 12m44s
This commit is contained in:
+14
-2
@@ -22,6 +22,15 @@ def documentation_only(paths: list[str]) -> bool:
|
||||
)
|
||||
|
||||
|
||||
def workflow_only(paths: list[str]) -> bool:
|
||||
"""Limit the cheap PR check to workflow YAML, never policy code."""
|
||||
return bool(paths) and all(
|
||||
path.startswith(".gitea/workflows/") and
|
||||
len(Path(path).parts) == 3 and Path(path).suffix == ".yml"
|
||||
for path in paths
|
||||
)
|
||||
|
||||
|
||||
def headless_packages(paths: list[str]) -> list[str]:
|
||||
"""Return tested reverse dependents for code outside the GUI graph."""
|
||||
changed: set[str] = set()
|
||||
@@ -95,12 +104,15 @@ def main() -> None:
|
||||
try:
|
||||
paths = changed_paths()
|
||||
docs = documentation_only(paths)
|
||||
packages = headless_packages(paths) if not docs else []
|
||||
workflow = workflow_only(paths) if not docs else False
|
||||
packages = headless_packages(paths) if not docs and not workflow else []
|
||||
except (OSError, subprocess.CalledProcessError, ValueError):
|
||||
paths = []
|
||||
docs = False
|
||||
workflow = False
|
||||
packages = []
|
||||
surface = "documentation" if docs else "headless" if packages else "full"
|
||||
surface = ("documentation" if docs else "workflow" if workflow else
|
||||
"headless" if packages else "full")
|
||||
print(f"surface={surface}")
|
||||
print(f"packages={' '.join(packages)}")
|
||||
print(f"Changed paths: {len(paths)}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user