Files
mcp-ssh-orchestrator/.github/workflows/lint-code.yml
T
dependabot[bot] 5234699a09 ci(deps): bump actions/checkout from 4.2.2 to 4.3.1 (#82)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 4.3.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.2.2...34e114876b0b11c390a56381ad16ebd13914f8d5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 4.3.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-08 17:54:32 -08:00

124 lines
3.3 KiB
YAML

name: Lint Code
# Top-level permissions set to read-only for OSSF Scorecard Token-Permissions check
# See: https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
permissions:
contents: read
on:
push:
branches: [main, develop]
paths:
- 'src/**/*.py'
- 'tests/**/*.py'
- 'pyproject.toml'
- 'setup.py'
- '.github/workflows/*.yml'
pull_request:
branches: [main]
# Paths filter removed - workflows run on all PRs but skip jobs when only docs change
jobs:
check-changes:
name: Check for code changes
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
has-code-changes: ${{ steps.filter.outputs.src == 'true' || steps.filter.outputs.tests == 'true' || steps.filter.outputs.config == 'true' }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Check for code changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: filter
with:
filters: |
src:
- 'src/**/*.py'
tests:
- 'tests/**/*.py'
config:
- 'pyproject.toml'
- 'setup.py'
- '.github/workflows/*.yml'
ruff:
name: Ruff Linting
needs: check-changes
if: needs.check-changes.outputs.has-code-changes == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install -e ".[dev]"
- name: Run ruff check
run: ruff check src/ tests/ --output-format=github
black:
name: Black Formatting
needs: check-changes
if: needs.check-changes.outputs.has-code-changes == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install -e ".[dev]"
- name: Run black
run: black --check --diff src/ tests/
mypy:
name: Type Checking
needs: check-changes
if: needs.check-changes.outputs.has-code-changes == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install -e ".[dev]"
- name: Run mypy
run: mypy src/ --ignore-missing-imports
continue-on-error: true
skip-docs-only:
name: Skip (docs only)
needs: check-changes
if: needs.check-changes.outputs.has-code-changes != 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Skip workflow
run: echo "Documentation-only PR - lint checks skipped"