ci(forgejo): check CHANGELOG channel suffix on the section title

The previous awk extracted the section body but excluded the title
line (## [TAG] - channel), so the '* - $CHANNEL*' pattern never
matched. Fix: include the title line in the extracted body, verify
the channel suffix on the title, then strip the title before passing
the body to the release API.
This commit is contained in:
Paul Schneider 2026-08-17 01:49:45 +01:00
commit 5e600c11e1
Signed by: notazof
GPG key ID: 1DD5D838E5343B06

View file

@ -125,12 +125,16 @@ jobs:
# Extraction de la section [TAG]. On cherche la première ligne # Extraction de la section [TAG]. On cherche la première ligne
# commençant par '## [' qui contient '[TAG]' (entre '## [' et # commençant par '## [' qui contient '[TAG]' (entre '## [' et
# la prochaine ligne '## [' ou fin de fichier). awk en mode # la prochaine ligne '## [' ou fin de fichier). awk en mode
# paragraphe suffit et reste POSIX. # paragraphe suffit et reste POSIX. On garde aussi le titre
# (ligne `## [TAG] - channel`) pour la vérification du canal.
BODY=$(awk -v tag="[$TAG]" ' BODY=$(awk -v tag="[$TAG]" '
/^## \[/ { /^## \[/ {
if (in_section) exit if (in_section) exit
if (index($0, tag) > 0) in_section=1 if (index($0, tag) > 0) {
next in_section=1
print
next
}
} }
in_section { print } in_section { print }
' CHANGELOG.md) ' CHANGELOG.md)
@ -143,13 +147,16 @@ jobs:
# Vérification cohérence du canal déclaré dans le suffixe. # Vérification cohérence du canal déclaré dans le suffixe.
# Format attendu : "## [TAG] - stable" / "- preview" / "- unstable". # Format attendu : "## [TAG] - stable" / "- preview" / "- unstable".
if [[ "$BODY" != *" - $CHANNEL"* ]]; then # On lit la première ligne du body qui contient le titre.
echo "::error::Section '## [$TAG]' must declare suffix '- $CHANNEL' to match tag parity." TITLE=$(echo "$BODY" | head -1)
echo "Current section body (first 5 lines):" if [[ "$TITLE" != *" - $CHANNEL"* ]]; then
echo "$BODY" | head -5 echo "::error::Section title '$TITLE' must declare suffix '- $CHANNEL' to match tag parity."
exit 1 exit 1
fi fi
# Body pour la release : retire la première ligne (titre).
BODY=$(echo "$BODY" | tail -n +2)
echo "Section CHANGELOG validée pour [$TAG] - $CHANNEL" echo "Section CHANGELOG validée pour [$TAG] - $CHANNEL"
# Expose channel + body pour les étapes suivantes via $GITHUB_ENV. # Expose channel + body pour les étapes suivantes via $GITHUB_ENV.