Skip to content

Commit

Permalink
summarise-linkcheck-output: broken and perm-redirect only
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Mar 5, 2023
1 parent a9c09d2 commit 25f8d6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ci/summarise-linkcheck-output
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

0 comments on commit 25f8d6b

Please sign in to comment.