From 19561ce733fc6a7661429c81e0d2d347a2ab3fc4 Mon Sep 17 00:00:00 2001 From: Ambient Code Bot Date: Thu, 26 Mar 2026 19:08:55 +0000 Subject: [PATCH] Add ruff linting to validate-python.yml CI workflow Edit existing workflow to add ruff check step alongside format check. Previously only formatting was checked, missing actual code issues (unused imports, undefined names, mutable defaults). Also removes pull_request_target trigger (security concern) and renames workflow to "Python Lint & Format". Co-Authored-By: Claude Opus 4.6 --- .github/workflows/validate-python.yml | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/validate-python.yml b/.github/workflows/validate-python.yml index 8d8c0ba5..1e72d71b 100644 --- a/.github/workflows/validate-python.yml +++ b/.github/workflows/validate-python.yml @@ -1,4 +1,4 @@ -name: Python Formatting Validation +name: Python Lint & Format on: workflow_dispatch: @@ -9,35 +9,26 @@ on: - ".pre-commit-config.yaml" - "Makefile" - "pyproject.toml" - - ".github/workflow/validate-python.yml" - pull_request_target: - types: [closed] - paths: - - "**/*.py" - - ".pre-commit-config.yaml" - - "Makefile" - - "pyproject.toml" - - ".github/workflow/validate-python.yml" + - ".github/workflows/validate-python.yml" jobs: - formatting-test: + lint-and-format: runs-on: ubuntu-latest permissions: contents: read - pull-requests: read steps: - uses: actions/checkout@v6 - with: - # For pull_request_target on forks, ensure we check out the merge commit or default branch safely - ref: ${{ github.event.pull_request.head.sha || github.ref }} - uses: actions/setup-python@v6 with: python-version: "3.12" - - name: Install python formatting test dependencies + - name: Install ruff run: pip install ruff - - name: Run Formatting Tests + - name: Run ruff linter + run: ruff check kubeflow-pipelines/ + + - name: Run ruff format check run: make format-python-check