mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-05-28 18:43:40 +00:00
chore(scripts): normalize release note footer across all backends
The Copilot backend relies on the AI to reproduce the footer text exactly, which leads to subtle differences (URL parameter order, whitespace, emoji encoding) compared to the git-cliff template in cliff.toml. Fix: define CANONICAL_FOOTER as a single bash constant and pipe all three backends (copilot, git-cliff, manual) through ensure_canonical_footer(), which strips any existing BMAC footer block and appends the canonical one. Also tell the AI not to generate a footer at all, since it is now added programmatically. The manual backend gains a footer it previously lacked. User-Impact: none
This commit is contained in:
parent
432eb6502c
commit
2092d28ece
1 changed files with 62 additions and 13 deletions
|
|
@ -375,13 +375,8 @@ Then sections using ### (H3 headings):
|
||||||
|
|
||||||
Skip any section that has no content.
|
Skip any section that has no content.
|
||||||
|
|
||||||
After the last section, ALWAYS end with this exact footer, no modifications:
|
Do NOT add any footer or sign-off. End your response after the last content section.
|
||||||
|
A footer is appended automatically after your response.
|
||||||
---
|
|
||||||
|
|
||||||
If this release saved you some money on your electricity bill, a coffee would be much appreciated! ☕
|
|
||||||
|
|
||||||
[](https://www.buymeacoffee.com/jpawlowski)
|
|
||||||
|
|
||||||
## TITLE SELECTION
|
## TITLE SELECTION
|
||||||
- Find the most user-impactful change: new sensors > bug fixes affecting data quality > reliability improvements > UI improvements > translations
|
- Find the most user-impactful change: new sensors > bug fixes affecting data quality > reliability improvements > UI improvements > translations
|
||||||
|
|
@ -466,6 +461,60 @@ End after the Buy Me A Coffee button. No meta-commentary, no explanations."
|
||||||
rm -f "$TEMP_PROMPT"
|
rm -f "$TEMP_PROMPT"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Canonical footer (appended by ensure_canonical_footer, backend-independent)
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# Defined here so it is the single source of truth for all backends.
|
||||||
|
# cliff.toml also contains this footer for direct git-cliff usage;
|
||||||
|
# ensure_canonical_footer strips any existing variant before re-appending.
|
||||||
|
CANONICAL_FOOTER='---
|
||||||
|
|
||||||
|
If this release saved you some money on your electricity bill, a coffee would be much appreciated! ☕
|
||||||
|
|
||||||
|
[](https://www.buymeacoffee.com/jpawlowski)'
|
||||||
|
|
||||||
|
# Strip any existing BMAC footer block (AI/template variant) then append the
|
||||||
|
# canonical footer defined above. Reads from stdin, writes to stdout.
|
||||||
|
# This guarantees all backends produce an identical footer.
|
||||||
|
ensure_canonical_footer() {
|
||||||
|
awk '
|
||||||
|
{
|
||||||
|
lines[NR] = $0
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
# Find the last buymeacoffee occurrence
|
||||||
|
bmac_line = 0
|
||||||
|
for (i = NR; i >= 1; i--) {
|
||||||
|
if (lines[i] ~ /buymeacoffee\.com\/jpawlowski/) {
|
||||||
|
bmac_line = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cut_at = NR
|
||||||
|
|
||||||
|
if (bmac_line > 0) {
|
||||||
|
# Walk back to find the nearest --- separator before the link
|
||||||
|
for (i = bmac_line - 1; i >= 1; i--) {
|
||||||
|
if (lines[i] ~ /^---[[:space:]]*$/) {
|
||||||
|
cut_at = i - 1 # Exclude the separator itself (footer provides its own)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# No --- found: cut at the buymeacoffee line itself
|
||||||
|
if (cut_at == NR) cut_at = bmac_line
|
||||||
|
}
|
||||||
|
|
||||||
|
# Trim trailing blank lines before the cut point
|
||||||
|
while (cut_at > 0 && lines[cut_at] ~ /^[[:space:]]*$/) cut_at--
|
||||||
|
|
||||||
|
for (i = 1; i <= cut_at; i++) print lines[i]
|
||||||
|
}
|
||||||
|
'
|
||||||
|
printf "\n%s\n" "$CANONICAL_FOOTER"
|
||||||
|
}
|
||||||
|
|
||||||
# Backend: git-cliff (template-based)
|
# Backend: git-cliff (template-based)
|
||||||
generate_with_gitcliff() {
|
generate_with_gitcliff() {
|
||||||
log_info "${BLUE}==> Generating with git-cliff${NC}"
|
log_info "${BLUE}==> Generating with git-cliff${NC}"
|
||||||
|
|
@ -829,26 +878,26 @@ if [ "$AUTO_UPDATE_AVAILABLE" = "true" ]; then
|
||||||
TEMP_NOTES=$(mktemp)
|
TEMP_NOTES=$(mktemp)
|
||||||
case "$BACKEND" in
|
case "$BACKEND" in
|
||||||
copilot)
|
copilot)
|
||||||
generate_with_copilot >"$TEMP_NOTES"
|
generate_with_copilot | ensure_canonical_footer >"$TEMP_NOTES"
|
||||||
;;
|
;;
|
||||||
git-cliff)
|
git-cliff)
|
||||||
generate_with_gitcliff >"$TEMP_NOTES"
|
generate_with_gitcliff | ensure_canonical_footer >"$TEMP_NOTES"
|
||||||
;;
|
;;
|
||||||
manual)
|
manual)
|
||||||
generate_with_manual >"$TEMP_NOTES"
|
generate_with_manual | ensure_canonical_footer >"$TEMP_NOTES"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
# No auto-update, just output to stdout
|
# No auto-update, just output to stdout
|
||||||
case "$BACKEND" in
|
case "$BACKEND" in
|
||||||
copilot)
|
copilot)
|
||||||
generate_with_copilot
|
generate_with_copilot | ensure_canonical_footer
|
||||||
;;
|
;;
|
||||||
git-cliff)
|
git-cliff)
|
||||||
generate_with_gitcliff
|
generate_with_gitcliff | ensure_canonical_footer
|
||||||
;;
|
;;
|
||||||
manual)
|
manual)
|
||||||
generate_with_manual
|
generate_with_manual | ensure_canonical_footer
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue