# Copyright 2022 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd # A workflow to lint Shaka Packager. name: Lint # Runs when called from another workflow. on: workflow_call: inputs: ref: required: true type: string # By default, run all commands in a bash shell. On Windows, the default would # otherwise be powershell. defaults: run: shell: bash jobs: lint: name: Lint runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 with: ref: ${{ inputs.ref }} # We must use 'fetch-depth: 2', or else the linter won't have another # revision to compare to. fetch-depth: 2 - name: Lint shell: bash run: | wget https://raw.githubusercontent.com/llvm-mirror/clang/master/tools/clang-format/git-clang-format sudo install -m 755 git-clang-format /usr/local/bin/git-clang-format rm git-clang-format python3 -m pip install --upgrade pylint==2.8.3 # NOTE: Must use base.sha instead of base.ref, since we don't have # access to the branch name that base.ref would give us. # NOTE: Must also use fetch-depth: 2 in actions/checkout to have access # to the base ref for comparison. packager/tools/git/check_formatting.py \ --binary /usr/bin/clang-format \ ${{ github.event.pull_request.base.sha || 'HEAD^' }} packager/tools/git/check_pylint.py