Check RSS fix
This commit is contained in:
29
bin/check-rss-template
Executable file
29
bin/check-rss-template
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
tmp_dir=$(mktemp -d)
|
||||
trap 'rm -rf "${tmp_dir}"' EXIT
|
||||
|
||||
hugo_version="${HUGO_VERSION:?HUGO_VERSION must be set}"
|
||||
upstream_template="${tmp_dir}/rss.xml"
|
||||
diff_output="${tmp_dir}/rss.diff"
|
||||
|
||||
curl -fsSL "https://raw.githubusercontent.com/gohugoio/hugo/refs/tags/v${hugo_version}/tpl/tplimpl/embedded/templates/rss.xml" \
|
||||
-o "${upstream_template}"
|
||||
|
||||
set +e
|
||||
diff "${upstream_template}" "${repo_root}/themes/v2/layouts/_default/rss.xml" >"${diff_output}"
|
||||
diff_status=$?
|
||||
set -e
|
||||
|
||||
if [[ "${diff_status}" -gt 1 ]]; then
|
||||
exit "${diff_status}"
|
||||
fi
|
||||
|
||||
line_count=$(wc -l <"${diff_output}" | tr -d ' ')
|
||||
if [[ "${line_count}" != "7" ]]; then
|
||||
echo "Unexpected RSS template diff line count: ${line_count}" >&2
|
||||
cat "${diff_output}" >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user