From 1ff422d1ddbe3fdbca7a6b94d19d5a6a7de31590 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 14 Feb 2026 10:13:43 +0100 Subject: [PATCH] Actions: improve long line check in pr commit validation. We allow long URLs on lines by themselves. --- .github/workflows/commit-validation-pr.yml | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/commit-validation-pr.yml b/.github/workflows/commit-validation-pr.yml index ce5bf1b22..b8aab60d3 100644 --- a/.github/workflows/commit-validation-pr.yml +++ b/.github/workflows/commit-validation-pr.yml @@ -13,13 +13,20 @@ jobs: fetch-depth: 0 - name: Check commit message length run: | - git log ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | ( - longlines=0 - while IFS='' read -r line; do - if [ "${#line}" -gt 78 ]; then - echo "Overlong line: ${line}" >&2 - longlines=$(( longlines + 1 )) + git log ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | ( + longlines=0 + while IFS='' read -r line; do + if [ "${#line}" -gt 78 ] ; then + if echo "$line" | grep -q '^\s*https://\S*\s*$'; then + echo "Ignoring long line with URL." + else + echo "Overlong line: ${line}" >&2 + if echo "$line" | grep -q 'https://'; then + echo "Put a long URL on a line by itself." + fi + longlines=$(( longlines + 1 )) + fi fi - done - [ "${longlines}" -eq 0 ] - ) + done + [ "${longlines}" -eq 0 ] + )