commit 4d0c65dcef882c5846d41a8813227a88a1da05b6
parent 7a50a7541a139b4c8222fd6c8dab5fb00b1c2764
Author: David Eisinger <[email protected]>
Date: Wed, 8 Apr 2026 22:50:11 -0400
Check RSS fix
Diffstat:
3 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/.build.yml b/.build.yml
@@ -30,10 +30,7 @@ tasks:
# Diff RSS template against Hugo default, make sure only differences are intentional
- rss: |
- curl -s https://raw.githubusercontent.com/gohugoio/hugo/refs/tags/v$HUGO_VERSION/tpl/tplimpl/embedded/templates/rss.xml \
- | diff - ./themes/v2/layouts/_default/rss.xml \
- | wc -l \
- | grep 7
+ ./bin/check-rss-template
# Start Ruby server for dithering images
- dither: |
diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml
@@ -33,11 +33,7 @@ jobs:
printf '%s' "$SECRET_KEY" > secret.key
- name: Verify RSS template diff
- run: |
- curl -s https://raw.githubusercontent.com/gohugoio/hugo/refs/tags/v${HUGO_VERSION}/tpl/tplimpl/embedded/templates/rss.xml \
- | diff - ./themes/v2/layouts/_default/rss.xml \
- | wc -l \
- | grep 7
+ run: ./bin/check-rss-template
- name: Build site
run: ./bin/build
diff --git a/bin/check-rss-template b/bin/check-rss-template
@@ -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