From 25f8d6b361670604756503455b4b3e5214c59055 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Sun, 5 Mar 2023 23:11:11 +0000 Subject: [PATCH] summarise-linkcheck-output: broken and perm-redirect only --- ci/summarise-linkcheck-output | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/summarise-linkcheck-output b/ci/summarise-linkcheck-output index 4d3a994721..864479337d 100755 --- a/ci/summarise-linkcheck-output +++ b/ci/summarise-linkcheck-output @@ -6,7 +6,7 @@ set -eu LINKCHECK="$1" N_BROKEN=$(jq -r 'select(.status=="broken")' "$LINKCHECK" | jq -s length) -N_REDIRECTED=$(jq -r 'select(.status=="redirected")' "$LINKCHECK" | jq -s length) +N_PERMANENT_REDIRECT=$(jq -r 'select(.status=="redirected")' "$LINKCHECK" | jq -s length) # shellcheck disable=SC2086 if [[ $N_BROKEN -gt 0 ]]; then @@ -15,9 +15,9 @@ if [[ $N_BROKEN -gt 0 ]]; then fi # shellcheck disable=SC2086 -if [[ $N_REDIRECTED -gt 0 ]]; then - printf "\n\033[35;1m%s\033[0m\n" "Redirected links" - jq -r 'select(.status=="redirected") | "\(.filename):\(.lineno) \(.uri)\n \(.code) \(.info)"' "$LINKCHECK" +if [[ $N_PERMANENT_REDIRECT -gt 0 ]]; then + printf "\n\033[35;1m%s\033[0m\n" "Permanently redirected links" + jq -r 'select(.status=="redirected" and .code==301) | "\(.filename):\(.lineno) \(.uri)\n \(.info)"' "$LINKCHECK" fi exit "$N_BROKEN"