blob: 3742d44cdd3dc6968a20d5eaa53b6348db5e7ef2 [file] [edit]
name: "LLDB Python Lint"
permissions:
contents: read
on:
pull_request:
paths:
- 'lldb/test/API/**.py'
- '.github/workflows/lldb-pylint-action.yml'
jobs:
code_linter:
if: github.repository_owner == 'llvm'
runs-on: ubuntu-24.04
timeout-minutes: 60
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Fetch LLVM sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 2
- name: Setup python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.14'
- name: Install dependencies
run: |
python3 -m pip install --require-hashes -r ./llvm/utils/git/requirements_pylint.txt
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
separator: " "
skip_initial_fetch: true
base_sha: 'HEAD~1'
sha: 'HEAD'
files: |
**/*.py
- name: List files
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "Changed files:"
echo "$CHANGED_FILES"
- name: Run Python test-name linter
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
# Only run pylint if we have any changed files at this point.
# Otherwise pylint errors out.
if: ${{ env.CHANGED_FILES != '' }}
run: |
pylint --disable=all --enable=E0102 $CHANGED_FILES