From 36a8cbbfe40a692cdaa51c5b14399cf18bc05159 Mon Sep 17 00:00:00 2001 From: Rohit Malhotra Date: Mon, 10 Nov 2025 14:39:49 -0500 Subject: [PATCH] Add GitHub CI workflow to check package versions (#11637) Co-authored-by: openhands --- .github/workflows/check-package-versions.yml | 65 ++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/check-package-versions.yml diff --git a/.github/workflows/check-package-versions.yml b/.github/workflows/check-package-versions.yml new file mode 100644 index 0000000000..44e680ff4b --- /dev/null +++ b/.github/workflows/check-package-versions.yml @@ -0,0 +1,65 @@ +name: Check Package Versions + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +jobs: + check-package-versions: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Check for any 'rev' fields in pyproject.toml + run: | + python - <<'PY' + import sys, tomllib, pathlib + + path = pathlib.Path("pyproject.toml") + if not path.exists(): + print("āŒ ERROR: pyproject.toml not found") + sys.exit(1) + + try: + data = tomllib.loads(path.read_text(encoding="utf-8")) + except Exception as e: + print(f"āŒ ERROR: Failed to parse pyproject.toml: {e}") + sys.exit(1) + + poetry = data.get("tool", {}).get("poetry", {}) + sections = { + "dependencies": poetry.get("dependencies", {}), + } + + errors = [] + + print("šŸ” Checking for any dependencies with 'rev' fields...\n") + for section_name, deps in sections.items(): + if not isinstance(deps, dict): + continue + + for pkg_name, cfg in deps.items(): + if isinstance(cfg, dict) and "rev" in cfg: + msg = f" āœ– {pkg_name} in [{section_name}] uses rev='{cfg['rev']}' (NOT ALLOWED)" + print(msg) + errors.append(msg) + else: + print(f" • {pkg_name}: OK") + + if errors: + print("\nāŒ FAILED: Found dependencies using 'rev' fields:\n" + "\n".join(errors)) + print("\nPlease use versioned releases instead, e.g.:") + print(' my-package = "1.0.0"') + sys.exit(1) + + print("\nāœ… SUCCESS: No 'rev' fields found. All dependencies are using proper versioned releases.") + PY