aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/checkpatch.yml
blob: 622542c543d2bf28591725d824982a27a83fb66d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Checkpatch

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
permissions:
  contents: read

jobs:
  checkpatch:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
      with:
        fetch-depth: 0
    - name: Install dependencies
      run: |
        sudo apt-get update
        sudo apt-get install -y perl
    - name: Run checkpatch.pl
      run: |
        git fetch origin ${{ github.base_ref }}
        base_commit=$(git merge-base origin/${{ github.base_ref }} HEAD)
        echo "Base commit: $base_commit"
        echo "Running checkpatch.pl on all commits in the PR:"
        git rev-list --reverse $base_commit..HEAD | while read commit; do
          subject=$(git log -1 --format=%s $commit)
          echo "Checking commit: $commit - $subject"
          if ! ./checkpatch.pl --no-tree --ignore MAINTAINERS,SPDX_LICENSE_TAG,COMMIT_MESSAGE,FILE_PATH_CHANGES,EMAIL_SUBJECT,AVOID_EXTERNS,GIT_COMMIT_ID,ENOSYS_SYSCALL -g $commit; then
            echo "checkpatch.pl found issues in commit $commit - $subject"
            exit 1
          fi
        done