From c389e09f3564f52ac0cf10719915347e57053b00 Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Tue, 18 Feb 2025 23:06:20 +0100 Subject: github checkpatch test: Fix for non pull requests It should only run for pull requests. Indentation for the branch to run on was also not right. Signed-off-by: Bernd Schubert --- .github/workflows/checkpatch.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '.github') diff --git a/.github/workflows/checkpatch.yml b/.github/workflows/checkpatch.yml index 622542c..f6acb1b 100644 --- a/.github/workflows/checkpatch.yml +++ b/.github/workflows/checkpatch.yml @@ -1,14 +1,10 @@ name: Checkpatch on: - push: - branches: - - master pull_request: + types: [opened, synchronize, reopened] branches: - master -permissions: - contents: read jobs: checkpatch: @@ -23,6 +19,10 @@ jobs: sudo apt-get install -y perl - name: Run checkpatch.pl run: | + if [ -z "${{ github.base_ref }}" ]; then + echo "Not a pull request, skipping checkpatch" + exit 0 + fi git fetch origin ${{ github.base_ref }} base_commit=$(git merge-base origin/${{ github.base_ref }} HEAD) echo "Base commit: $base_commit" -- cgit v1.2.3