From 58c7469110e0ff5a3d418b08df34f2a35a77d6eb Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Mon, 7 Sep 2020 14:10:50 +0100 Subject: [PATCH] action: Allow long lines if non-alphabetic Overly long commit lines are annoying. But sometimes, we need to be able to force the use of long lines (for example to reference a URL). Ironically, I can't refer to the URL that explains this because of ... the long line check! Hence: ```sh $ cat < --- .github/workflows/commit-message-check.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/commit-message-check.yaml b/.github/workflows/commit-message-check.yaml index d3b28131a3..1b46714c9a 100644 --- a/.github/workflows/commit-message-check.yaml +++ b/.github/workflows/commit-message-check.yaml @@ -48,7 +48,25 @@ jobs: uses: tim-actions/commit-message-checker-with-regex@v0.3.1 with: commits: ${{ steps.get-pr-commits.outputs.commits }} - pattern: '^.+(\n.{0,72})*$|^.+\n\s*[^a-zA-Z\s\n]|^.+\n\S+$' + # Notes: + # + # - The subject line is not enforced here (see other check), but has + # to be specified at the start of the regex as the action is passed + # the entire commit message. + # + # - Body lines *can* be longer than the maximum if they start + # with a non-alphabetic character. + # + # This allows stack traces, log files snippets, emails, long URLs, + # etc to be specified. Some of these naturally "work" as they start + # with numeric timestamps or addresses. Emails can but quoted using + # the normal ">" character, markdown bullets ("-", "*") are also + # useful for lists of URLs, but it is always possible to override + # the check by simply space indenting the content you need to add. + # + # - A SoB comment can be any length (as it is unreasonable to penalise + # people with long names/email addresses :) + pattern: '^.+(\n([a-zA-Z].{0,149}|[^a-zA-Z\n].*|Signed-off-by:.*|))+$' error: 'Body line too long (max 72)' post_error: ${{ env.error_msg }}