|
From: Gleb C. <lna...@ya...> - 2023-04-11 08:53:07
|
Commit: 1376ad0 GitHub URL: https://github.com/SCST-project/scst/commit/1376ad014d2187089b91066295811a889bfb80de Author: Gleb Chesnokov Date: 2023-04-11T11:52:35+03:00 Log Message: ----------- github: Add a GitHub action to run checkpatch upon pull request Add a new GitHub Actions workflow, checkpatch_pull.yml, which runs checkpatch.pl for each commit in a pull request targeting the master branch. This change ensures proper checkpatch validation for both push and pull request events. Modified Paths: -------------- .github/workflows/checkpatch.yml | 42 ------------- .github/workflows/checkpatch_pull.yml | 47 +++++++++++++++ .github/workflows/checkpatch_push.yml | 45 ++++++++++++++ 3 files changed, 92 insertions(+), 42 deletions(-) =================================================================== diff --git a/.github/workflows/checkpatch_pull.yml b/.github/workflows/checkpatch_pull.yml new file mode 100644 index 0000000..3cb4eee --- /dev/null +++ b/.github/workflows/checkpatch_pull.yml @@ -0,0 +1,47 @@ +name: Checkpatch upon pull + +on: + pull_request: + branches: + - master + +jobs: + checkpatch: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: ${{github.event.pull_request.head.sha}} + fetch-depth: 0 + + - name: Download checkpatch.pl + run: | + curl https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl -o checkpatch.pl + curl https://raw.githubusercontent.com/torvalds/linux/master/scripts/spelling.txt -o spelling.txt + curl https://raw.githubusercontent.com/torvalds/linux/master/scripts/const_structs.checkpatch -o const_structs.checkpatch + chmod +x checkpatch.pl + + - name: Run checkpatch.pl + run: | + ignore=( + MISSING_SIGN_OFF + EMAIL_SUBJECT + UNKNOWN_COMMIT_ID + NO_AUTHOR_SIGN_OFF + FILE_PATH_CHANGES + SPDX_LICENSE_TAG + LINUX_VERSION_CODE + CONSTANT_COMPARISON + SPACING + ) + ignore_str=${ignore[*]} + + base_commit=${{github.event.pull_request.base.sha}} + commits=$(git log --pretty=format:"%h" $base_commit..HEAD) + + for commit in $commits; do + echo "Running checkpatch.pl for commit $commit" + git format-patch -1 --stdout $commit | ./checkpatch.pl --no-tree --show-types --ignore="${ignore_str// /,}" - + echo + done diff --git a/.github/workflows/checkpatch.yml b/.github/workflows/checkpatch_push.yml similarity index 94% rename from .github/workflows/checkpatch.yml rename to .github/workflows/checkpatch_push.yml index 080327d..98484cd 100644 --- a/.github/workflows/checkpatch.yml +++ b/.github/workflows/checkpatch_push.yml @@ -1,6 +1,9 @@ -name: Checkpatch +name: Checkpatch upon push -on: [push] +on: + push: + branches: + - master jobs: checkpatch: |