1# Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================== 15 16name: PyLint 17on: 18 pull_request: 19 paths: 20 - '**.py' 21 22jobs: 23 build: 24 name: PyLint 25 runs-on: ubuntu-latest 26 steps: 27 - name: Checkout code 28 uses: actions/checkout@v2 29 - name: Get file changes 30 id: get_file_changes 31 uses: trilom/file-changes-action@v1.2.4 32 with: 33 output: ' ' 34 - name: Report list of changed files 35 run: | 36 echo Changed files: ${{ steps.get_file_changes.outputs.files }} 37 - name: Set up Python 3.8 38 uses: actions/setup-python@v1 39 with: 40 python-version: 3.8 41 - name: Install Python dependencies 42 run: | 43 python -m pip install --upgrade pip 44 pip install pylint numpy wheel 45 pip install keras_preprocessing --no-deps 46 - name: Run PyLint on changed files 47 run: | 48 echo "${{ steps.get_file_changes.outputs.files}}" | tr " " "\n" | grep ".py$" | xargs pylint --rcfile=tensorflow/tools/ci_build/pylintrc 49