diff --git a/.gitea/workflows/forge-announce.yml b/.gitea/workflows/forge-announce.yml index 10e82ea..1d646fb 100644 --- a/.gitea/workflows/forge-announce.yml +++ b/.gitea/workflows/forge-announce.yml @@ -120,17 +120,37 @@ jobs: $enBlock = $rest.TrimEnd() } - # ---------- Char-Cap-Check (5500 Total auf title + description + footer) ---------- + # ---------- Embed-Felder + Per-Field-Caps (Discord-Hard-Limits) ---------- + # Discord enforces per-embed-field limits separately from the + # combined-total limit. We split the DE and EN blocks into two + # embeds that share the same release URL so Discord stitches + # them into one visual card. Hard caps per Discord docs: + # description: 4096 per embed + # title: 256 per embed + # footer.text: 2048 per embed + # combined sum across all embeds: 6000 $title = "Hellion Chat $version — $subtitle" - $description = "**Deutsch**`n`n$deBody`n`n**English**`n`n$enBlock" + $deDesc = "**Deutsch**`n`n$deBody" + $enDesc = "**English**`n`n$enBlock" $footerText = "Hellion Forge · $versionsnatur" - $totalChars = $title.Length + $description.Length + $footerText.Length - if ($totalChars -gt 5500) { - throw "V6: Total char count $totalChars exceeds 5500 limit. Major-Release detected — please post manually via Bot/Multi-Embed (see forge style §8). Forge-Auto-Announce stays off for this tag." - } - Write-Host "Char-Cap OK: $totalChars / 5500" + $releaseUrl = "https://gitea.hellion-forge.cloud/JonKazama-Hellion/HellionChat/releases/tag/$tag" - # ---------- Embed-Payload bauen ---------- + if ($deDesc.Length -gt 4096) { + throw "V6a: DE-Body too long for one embed ($($deDesc.Length) chars, max 4096). Trim .github/forge-posts/$tag.md or post the announcement manually (see forge style §8)." + } + if ($enDesc.Length -gt 4096) { + throw "V6b: EN-Block too long for one embed ($($enDesc.Length) chars, max 4096). Trim the changelog entry in HellionChat/HellionChat.yaml or post manually." + } + $totalChars = $title.Length + $deDesc.Length + $enDesc.Length + $footerText.Length + if ($totalChars -gt 6000) { + throw "V6c: Combined embed chars $totalChars exceed Discord's 6000-total limit. Major-Release detected — post manually via Bot/Multi-Embed (see forge style §8)." + } + Write-Host "Embed-Caps OK: de=$($deDesc.Length)/4096, en=$($enDesc.Length)/4096, total=$totalChars/6000" + + # ---------- Embed-Payload bauen (zwei Embeds, gleiche url) ---------- + # Sharing the same `url` tells Discord to render both embeds as a + # single contiguous card block. The title sits on the first embed, + # the footer + timestamp on the last so it reads as one post. $payload = [ordered]@{ username = "Forge Herald" avatar_url = "https://gitea.hellion-forge.cloud/JonKazama-Hellion/HellionChat/raw/branch/main/HellionChat/images/icon.png" @@ -142,9 +162,14 @@ jobs: embeds = @( [ordered]@{ title = $title - url = "https://gitea.hellion-forge.cloud/JonKazama-Hellion/HellionChat/releases/tag/$tag" + url = $releaseUrl color = 12730636 - description = $description + description = $deDesc + }, + [ordered]@{ + url = $releaseUrl + color = 12730636 + description = $enDesc footer = [ordered]@{ text = $footerText } timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ") }