From 77d82811ad1190057b578a8ca3625e7d3303dd35 Mon Sep 17 00:00:00 2001 From: Ben Grande Date: Sun, 28 Jan 2024 23:13:24 +0100 Subject: [PATCH] ci: lint pull request --- .github/workflows/main.yaml | 14 +++++++++++--- .gitlint | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1eb0a65..24f0c59 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -46,9 +46,17 @@ jobs: - name: Lint commits # yamllint disable-line rule:line-length run: | - if test "${{ github.event.before }}" = "${{ github.event.after }}" || test -z "${{ github.event.before }}" + if test "${{ github.event_name}}" = "pull_request" then - gitlint --debug --commit "${{ github.event.after }}" + base="${{ github.event.pull_request.base.sha }}" + head="${{ github.event.pull_request.head.sha }}" else - gitlint --debug --commits "${{ github.event.before }}..${{ github.event.after }}" + base="${{ github.event.before }}" + head="${{ github.event.after }}" + fi + if test "${base}" = "${head}" || test -z "${base}" + then + gitlint --debug --commit "${head}" + else + gitlint --debug --commits "${base}..${head}" fi diff --git a/.gitlint b/.gitlint index e3a33c3..7b95c9b 100644 --- a/.gitlint +++ b/.gitlint @@ -32,7 +32,7 @@ line-length=72 min-length=20 [body-is-missing] -ignore-merge-commits=false +ignore-merge-commits=true [ignore-body-lines] regex=(^Co-Authored-By)|(^Reported-by)|(^Signed-off-by)