workflow: Run checkpatch against diff with riscv (#822)

* workflow: Run checkpatch against pull request only

Instead of arbitrarily picking 20 changes.

Change-Id: I5ec488aa4faa0b06056aa91d0432cda1674967b7
Signed-off-by: Tim Newsome <tim@sifive.com>

* Display FETCH_HEAD in the log

Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
Signed-off-by: Tim Newsome <tim@sifive.com>

---------

Signed-off-by: Tim Newsome <tim@sifive.com>
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com>
This commit is contained in:
Tim Newsome 2023-04-13 08:38:59 -07:00 committed by GitHub
parent 92dd9eed71
commit 4d274298b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -10,16 +10,20 @@ jobs:
BUILD_DIR: ../build BUILD_DIR: ../build
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 50 fetch-depth: 0
- name: Checkout Base
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}
echo "The current base for checkpatch is: $(git show FETCH_HEAD --oneline --raw)"
- name: Install required packages (apt-get) - name: Install required packages (apt-get)
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install patchutils python3-ply python3-git sudo apt-get install patchutils python3-ply python3-git
- name: Run checkpatch - name: Run checkpatch
run: | run: |
git diff -U20 HEAD~40 \ git diff --patch FETCH_HEAD \
| filterdiff \ | filterdiff \
-x "a/src/jtag/drivers/libjaylink/*" \ -x "a/src/jtag/drivers/libjaylink/*" \
-x "a/tools/git2cl/*" \ -x "a/tools/git2cl/*" \