From 24ed8511dd87bc53d65a7e5a569356336821af08 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Tue, 7 Sep 2021 22:36:17 +0300 Subject: [PATCH] CI+Meta: Add Signed-off-by tag filter to the commit message linter --- .github/workflows/lintcommits.yml | 8 ++++++++ Meta/lint-commit.sh | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/lintcommits.yml b/.github/workflows/lintcommits.yml index 116726344ce..7e33d816edf 100644 --- a/.github/workflows/lintcommits.yml +++ b/.github/workflows/lintcommits.yml @@ -55,6 +55,14 @@ jobs: pattern: '^.+[^.\n](\n.*)*$' error: 'Commit title ends in a period' + - name: Check body for sign off + if: ${{ success() || failure() }} + uses: tim-actions/commit-message-checker-with-regex@v0.3.1 + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} + pattern: '^((?!Signed-off-by: )[\s\S])*$' + error: 'Commit body contains a Signed-off-by tag' + - name: Comment on PR if: ${{ failure() && !github.event.pull_request.draft }} uses: IdanHo/comment-on-pr@5f51df338210754f519f721f8320d8f72525a4d0 diff --git a/Meta/lint-commit.sh b/Meta/lint-commit.sh index 6242b672998..1df284f930b 100755 --- a/Meta/lint-commit.sh +++ b/Meta/lint-commit.sh @@ -46,5 +46,10 @@ while read -r line; do if [[ $line_length -gt 72 ]] && (echo "$line" | grep -P -v -q "$url_pattern"); then error "Commit message lines are too long (maximum allowed is 72 characters)" fi + + if [[ "$line" == "Signed-off-by: "* ]]; then + error "Commit body contains a Signed-off-by tag" + fi + done <"$commit_file" exit 0