From 683aeab1a38ac63b492ebf85bb4515d369439481 Mon Sep 17 00:00:00 2001 From: Jack Spiering <46534141+jackspiering@users.noreply.github.com> Date: Fri, 20 Nov 2026 14:57:47 +0100 Subject: [PATCH 1/2] CI: check the service list both ways, the service files, and the README headings --- .github/scripts/check-service-list.sh | 35 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/scripts/check-service-list.sh b/.github/scripts/check-service-list.sh index fb3c60d7..2eb5593e 100755 --- a/.github/scripts/check-service-list.sh +++ b/.github/scripts/check-service-list.sh @@ -1,10 +1,14 @@ #!/usr/bin/env bash -# Every stack in services/ needs a row in the root README.md, and the rows of -# each category stay in alphabetical order of the bold name, ignoring case -# (AGENTS.md, "Files that change together"). Run it from the repository root. +# Every stack in services/ needs one row in the root README.md, every row +# links to a stack that exists, and the rows of each category stay in +# alphabetical order of the bold name, ignoring case (AGENTS.md, "Files that +# change together"). Every stack has compose.yaml, .env, and README.md, and the +# README uses the headings of the template in order (CONTRIBUTING.md, "Complete +# the service README"). Run it from the repository root. set -euo pipefail status=0 +heading_order='At a glance\|Before you start\|Deviations from the standard setup\|First run(\|Configuration)?(\|Troubleshooting)?(\|Upgrading)?\|Links' for dir in services/*/; do name=${dir#services/} name=${name%/} @@ -12,8 +16,33 @@ for dir in services/*/; do echo "::error file=README.md::services/${name} has no row in README.md" status=1 fi + for file in compose.yaml .env README.md; do + if [ ! -f "${dir}${file}" ]; then + echo "::error file=${dir}${file}::services/${name} has no ${file}" + status=1 + fi + done + if [ -f "${dir}README.md" ]; then + headings=$(awk '/^```/ { fence = !fence } !fence && /^## / { sub(/^## /, ""); print }' "${dir}README.md" | paste -sd '|' -) + if ! grep -qxE "$heading_order" <<<"$headings"; then + echo "::error file=${dir}README.md::The level-two headings must be those of templates/service-template/README.md, in order, with only Configuration, Troubleshooting, and Upgrading added before Links. Found: ${headings//|/, }" + status=1 + fi + fi done +links=$(grep -oE '\]\(/?services/[^)/]+/?\)' README.md | sed -E 's#^\]\(/?services/##; s#/?\)$##') +while IFS= read -r name; do + if [ ! -d "services/${name}" ]; then + echo "::error file=README.md::README.md has a row for services/${name}, which does not exist" + status=1 + fi +done < <(sort -u <<<"$links") +while IFS= read -r name; do + echo "::error file=README.md::services/${name} has more than one row in README.md" + status=1 +done < <(sort <<<"$links" | uniq -d) + while IFS= read -r line; do echo "::error file=README.md::${line}" status=1 From 539521dd258f5b57095a9dcb0d37e6af70294907 Mon Sep 17 00:00:00 2001 From: Jack Spiering <46534141+jackspiering@users.noreply.github.com> Date: Sun, 22 Nov 2026 21:49:28 +0100 Subject: [PATCH 2/2] CI: take service links only from the list rows, and skip ~~~ and indented fences Review findings W8 and S1 on #429: - Only the rows of the service list, which start with "| **", count. A link in other text no longer hides a missing row or counts as a second row. - Headings inside ~~~ fences, and inside fences indented by up to three spaces, are skipped too. --- .github/scripts/check-service-list.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/scripts/check-service-list.sh b/.github/scripts/check-service-list.sh index 2eb5593e..ededf773 100755 --- a/.github/scripts/check-service-list.sh +++ b/.github/scripts/check-service-list.sh @@ -9,10 +9,13 @@ set -euo pipefail status=0 heading_order='At a glance\|Before you start\|Deviations from the standard setup\|First run(\|Configuration)?(\|Troubleshooting)?(\|Upgrading)?\|Links' +# The rows of the service list start with "| **". Links to a stack elsewhere +# in README.md do not count as rows. +links=$(grep -E '^\| \*\*' README.md | grep -oE '\]\(/?services/[^)/]+/?\)' | sed -E 's#^\]\(/?services/##; s#/?\)$##') for dir in services/*/; do name=${dir#services/} name=${name%/} - if ! grep -qE "\]\(/?services/${name}/?\)" README.md; then + if ! grep -qxF "$name" <<<"$links"; then echo "::error file=README.md::services/${name} has no row in README.md" status=1 fi @@ -23,7 +26,13 @@ for dir in services/*/; do fi done if [ -f "${dir}README.md" ]; then - headings=$(awk '/^```/ { fence = !fence } !fence && /^## / { sub(/^## /, ""); print }' "${dir}README.md" | paste -sd '|' -) + # Skip fenced code blocks: ``` or ~~~, indented by up to three spaces. + headings=$(awk ' + { line = $0; sub(/^ ? ? ?/, "", line) } + fence != "" { if (line ~ ("^" fence char "*[ \t]*$")) fence = ""; next } + match(line, /^(```+|~~~+)/) { fence = substr(line, 1, RLENGTH); char = substr(fence, 1, 1); next } + /^## / { sub(/^## /, ""); print } + ' "${dir}README.md" | paste -sd '|' -) if ! grep -qxE "$heading_order" <<<"$headings"; then echo "::error file=${dir}README.md::The level-two headings must be those of templates/service-template/README.md, in order, with only Configuration, Troubleshooting, and Upgrading added before Links. Found: ${headings//|/, }" status=1 @@ -31,7 +40,6 @@ for dir in services/*/; do fi done -links=$(grep -oE '\]\(/?services/[^)/]+/?\)' README.md | sed -E 's#^\]\(/?services/##; s#/?\)$##') while IFS= read -r name; do if [ ! -d "services/${name}" ]; then echo "::error file=README.md::README.md has a row for services/${name}, which does not exist"