Skip to content

The agent that grows with you

refactor(ci): hoist docker detect-changes into the .py file

ethernet1dbe469276b1
diff --git a/.github/actions/detect-changes/action.yml b/.github/actions/detect-changes/action.yml
index 967e566878f..9c8fb223e8f 100644
--- a/.github/actions/detect-changes/action.yml
+++ b/.github/actions/detect-changes/action.yml
@@ -24,6 +24,9 @@ outputs:
docker_meta:
description: Docker setup and meta files have changed.
value: ${{ steps.classify.outputs.docker_meta }}
+ docker:
+ description: Files included in the docker image have changed.
+ value: ${{ steps.classify.outputs.docker }}
site:
description: Build the Docusaurus docs site.
value: ${{ steps.classify.outputs.site }}
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index a39c4150daa..8c259fe8725 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -52,14 +52,14 @@ jobs:
- name: Decide whether to build
id: gate
env:
- # python_prod (not python): the image copies installed code, never
- # tests/, so tests-only PRs skip the build.
- PYTHON_PROD: ${{ steps.classify.outputs.python_prod }}
- FRONTEND: ${{ steps.classify.outputs.frontend }}
- DOCKER_META: ${{ steps.classify.outputs.docker_meta }}
+ # The docker lane derives from python_prod (not python: the image
+ # copies installed code, never tests/, so tests-only PRs skip the
+ # build), frontend and docker_meta. classify_changes.py owns the
+ # formula so this gate and the nix lane cannot drift apart.
+ DOCKER: ${{ steps.classify.outputs.docker }}
run: |
set -euo pipefail
- if [ "$PYTHON_PROD" = "true" ] || [ "$FRONTEND" = "true" ] || [ "$DOCKER_META" = "true" ]; then
+ if [ "$DOCKER" = "true" ]; then
echo "build=true" >> "$GITHUB_OUTPUT"
else
echo "build=false" >> "$GITHUB_OUTPUT"
diff --git a/scripts/ci/classify_changes.py b/scripts/ci/classify_changes.py
index 3e781233bc0..c5e9db383be 100644
--- a/scripts/ci/classify_changes.py
+++ b/scripts/ci/classify_changes.py
@@ -14,6 +14,7 @@ Lanes:
test suite. A tests-only PR keeps ``python`` (pytest must run) while
skipping those product jobs.
* ``docker_meta`` — Dockerfiles etc.
+* ``docker`` — any product change + docker meta
* ``frontend`` — TS typecheck matrix + desktop build.
* ``site`` — Docusaurus + generated skill docs.
* ``scan`` — supply-chain scan (Python files, .pth, setup hooks).
@@ -127,16 +128,24 @@ def ci_review_files(files: list[str]) -> list[str]:
def classify(files: list[str]) -> dict[str, bool]:
"""Map changed paths to ``{lane: should_run}``."""
files = [f.strip() for f in files if f.strip()]
+ python = any(not _py_irrelevant(f) for f in files)
+ python_prod = any(not _py_irrelevant(f) and not _py_test_only(f) for f in files)
+ frontend = any(f.startswith(_FRONTEND) or f in _ROOT_NPM for f in files)
+ deps = any(f == "pyproject.toml" for f in files)
+ npm_lock = any(f.split("/")[-1] == "package-lock.json" for f in files)
+ docker_meta = any(f.startswith(_DOCKER_META) for f in files)
+
ret = {
- "python": any(not _py_irrelevant(f) for f in files),
- "python_prod": any(not _py_irrelevant(f) and not _py_test_only(f) for f in files),
- "docker_meta": any(f.startswith(_DOCKER_META) for f in files),
- "frontend": any(f.startswith(_FRONTEND) or f in _ROOT_NPM for f in files),
+ "python": python,
+ "python_prod": python_prod,
+ "docker": docker_meta or python_prod or frontend,
+ "docker_meta": docker_meta,
+ "frontend": frontend,
"site": any(f.startswith(_SITE) for f in files),
"scan": any(_is_scan(f) for f in files),
- "deps": any(f == "pyproject.toml" for f in files),
+ "deps": deps,
"uv_lock": any(f in ("pyproject.toml", "uv.lock") for f in files),
- "npm_lock": any(f.split("/")[-1] == "package-lock.json" for f in files),
+ "npm_lock": npm_lock,
"installer": any(_is_installer(f) for f in files),
"mcp_catalog": any(_is_mcp_catalog(f) for f in files),
"ci_review": any(_is_ci_review(f) for f in files),
@@ -144,6 +153,7 @@ def classify(files: list[str]) -> dict[str, bool]:
if not files or any(f.startswith(".github/") for f in files):
ret["python"] = True
ret["python_prod"] = True
+ ret["docker"] = True
ret["docker_meta"] = True
ret["frontend"] = True
ret["site"] = True
diff --git a/tests/ci/test_classify_changes.py b/tests/ci/test_classify_changes.py
index 94ec212ee6c..d1df6cdac25 100644
--- a/tests/ci/test_classify_changes.py
+++ b/tests/ci/test_classify_changes.py
@@ -25,6 +25,7 @@ DEFAULT = {
"python": True,
"python_prod": True,
"frontend": True,
+ "docker": True,
"docker_meta": True,
"site": True,
"scan": True,