Skip to content

Commit 76dabd5

Browse files
authored
CI/Skills: add Python lint and test harness for skills scripts (#24246)
* CI: add skills Python checks job * Chore: add Python lint and test pre-commit hooks * Tests: fix skill-creator package test import path * Chore: add Python tooling config for skills scripts * CI: run all skills Python tests * Chore: run all skills Python tests in pre-commit * Chore: enable pytest discovery for all skills tests * Changelog: note skills Python quality harness
1 parent de96f5f commit 76dabd5

5 files changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,32 @@ jobs:
317317
- name: Check docs
318318
run: pnpm check:docs
319319

320+
skills-python:
321+
needs: [docs-scope, changed-scope]
322+
if: needs.docs-scope.outputs.docs_only != 'true' && (github.event_name == 'push' || needs.changed-scope.outputs.run_node == 'true')
323+
runs-on: blacksmith-16vcpu-ubuntu-2404
324+
steps:
325+
- name: Checkout
326+
uses: actions/checkout@v4
327+
with:
328+
submodules: false
329+
330+
- name: Setup Python
331+
uses: actions/setup-python@v5
332+
with:
333+
python-version: "3.12"
334+
335+
- name: Install Python tooling
336+
run: |
337+
python -m pip install --upgrade pip
338+
python -m pip install pytest ruff
339+
340+
- name: Lint Python skill scripts
341+
run: python -m ruff check skills
342+
343+
- name: Test skill Python scripts
344+
run: python -m pytest -q skills
345+
320346
secrets:
321347
runs-on: blacksmith-16vcpu-ubuntu-2404
322348
steps:

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,24 @@ repos:
6969
args: [--persona=regular, --min-severity=medium, --min-confidence=medium]
7070
exclude: "^(vendor/|Swabble/)"
7171

72+
# Python checks for skills scripts
73+
- repo: https://github.com/astral-sh/ruff-pre-commit
74+
rev: v0.14.1
75+
hooks:
76+
- id: ruff
77+
files: "^skills/.*\\.py$"
78+
args: [--config, pyproject.toml]
79+
80+
- repo: local
81+
hooks:
82+
- id: skills-python-tests
83+
name: skills python tests
84+
entry: pytest -q skills
85+
language: python
86+
additional_dependencies: [pytest>=8,<9]
87+
pass_filenames: false
88+
files: "^skills/.*\\.py$"
89+
7290
# Project checks (same commands as CI)
7391
- repo: local
7492
hooks:

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ Docs: https://docs.openclaw.ai
1111
### Breaking
1212

1313
### Fixes
14+
1415
- Security/Skills: escape user-controlled prompt, filename, and output-path values in `openai-image-gen` HTML gallery generation to prevent stored XSS in generated `index.html` output. (#12538) Thanks @CornBrother0x.
1516
- Security/OTEL: redact sensitive values (API keys, tokens, credential fields) from diagnostics-otel log bodies, log attributes, and error/reason span fields before OTLP export. (#12542) Thanks @brandonwise.
1617
- Providers/OpenRouter: remove conflicting top-level `reasoning_effort` when injecting nested `reasoning.effort`, preventing OpenRouter 400 payload-validation failures for reasoning models. (#24120) thanks @tenequm.
18+
- Skills/Python: add CI + pre-commit linting (`ruff`) and pytest discovery coverage for Python scripts/tests under `skills/`, including package test execution from repo root. Thanks @vincentkoc.
1719

1820
## 2026.2.23
1921

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[tool.ruff]
2+
target-version = "py310"
3+
line-length = 100
4+
5+
[tool.ruff.lint]
6+
select = ["E9", "F63", "F7", "F82", "I"]
7+
8+
[tool.pytest.ini_options]
9+
testpaths = ["skills"]
10+
python_files = ["test_*.py"]

skills/skill-creator/scripts/test_package_skill.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
from pathlib import Path
1111
from unittest import TestCase, main
1212

13+
SCRIPT_DIR = Path(__file__).resolve().parent
14+
if str(SCRIPT_DIR) not in sys.path:
15+
sys.path.insert(0, str(SCRIPT_DIR))
16+
1317

1418
fake_quick_validate = types.ModuleType("quick_validate")
1519
fake_quick_validate.validate_skill = lambda _path: (True, "Skill is valid!")

0 commit comments

Comments
 (0)