Files
macos_security/.github/workflows/lint.yaml
2026-07-16 16:18:33 -04:00

101 lines
2.6 KiB
YAML

---
name: Lint Code Base
on:
workflow_dispatch:
push:
branches:
- main
- dev_27
pull_request:
branches:
- main
jobs:
pythonlint:
name: pythonlint
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
with:
files: |
src/mscp/**.py
- name: Set up Python
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.12.1'
- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: |
python3 -m pip install --upgrade flake8 flake8-bugbear
- name: Lint Python files
if: steps.changed-files.outputs.any_changed == 'true'
run: flake8 --config .github/linters/tox.ini src/mscp
yamllint:
name: yamllint
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
with:
files: |
**.yml
**.yaml
- name: Set up Python
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.13'
- name: Install yamllint
if: steps.changed-files.outputs.any_changed == 'true'
shell: bash
run: |
pip install yamllint
- name: Run yamllint
if: steps.changed-files.outputs.any_changed == 'true'
run: |
yamllint --config-file .github/linters/.yamllint.yaml --format github ${{ steps.changed-files.outputs.all_changed_files }}
lint_success:
needs:
- pythonlint
- yamllint
if: |
always()
name: Lint successful
runs-on: ubuntu-latest
steps:
- name: Check job status
if: >-
${{
(
contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
)
}}
run: exit 1