π OpenHands: AI-Driven Development
Add GitHub CI workflow to check package versions (#11637)
Rohit Malhotra36a8cbbfe40a
diff --git a/.github/workflows/check-package-versions.yml b/.github/workflows/check-package-versions.ymlnew file mode 100644index 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