name: "Pre-commit consistency check" on: workflow_dispatch: pull_request: concurrency: group: ${{ github.head_ref }}-precommit cancel-in-progress: true jobs: pre-commit-check: name: Run pre-commit checks runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 with: fetch-depth: 0 - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3 id: filter with: token: ${{ secrets.BOT_TOKEN }} list-files: shell filters: | addedOrModified: - added|modified: '**' # run only if changed files were detected - name: Run against changes uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 if: steps.filter.outputs.addedOrModified == 'true' with: extra_args: --files ${{ steps.filter.outputs.addedOrModified_files }} # run if no changed files were detected (e.g. workflow_dispatch on master branch) - name: Run against all files uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 if: steps.filter.outputs.addedOrModified != 'true' with: extra_args: --all-files