fix: verify Gitea 1.27.3 and repair push mail templates

This commit is contained in:
KenanZhu committed 2026-09-23 13:51:22 +08:00
1 parent a4ba20418c
commit dfb5024dfb
9 files changed
+104 -50

No files matched your search

+7 -24
View File
@@ -80,30 +80,12 @@ jobs:
ROW="| **${NEW}** | ${TODAY} | ⏳ Pending Verification | TBD |" ROW="| **${NEW}** | ${TODAY} | ⏳ Pending Verification | TBD |"
sed -i "${INSERT}a ${ROW}" COMPATIBILITY.md sed -i "${INSERT}a ${ROW}" COMPATIBILITY.md
- name: COMPATIBILITY.md — latest verified note - name: README.md — pending badge
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
# Update version inline on the line with TRACKER:LATEST-VERIFIED
sed -i "/TRACKER:LATEST-VERIFIED/s/Gitea [0-9.]*/Gitea ${NEW}/" COMPATIBILITY.md
- name: README.md — badge and latest tested
if: steps.version.outputs.skip != 'true' if: steps.version.outputs.skip != 'true'
run: | run: |
NEW="${{ steps.version.outputs.new_version }}" NEW="${{ steps.version.outputs.new_version }}"
# Badge: update version, change label tested→pending, color blue→yellow # Badge: update version, change label tested→pending, color blue→yellow
sed -i "/TRACKER:BADGE/s/%20[0-9a-z.-]*%20tested-blue/%20${NEW}%20pending-yellow/" README.md sed -i "/TRACKER:BADGE/s/%20[0-9a-z.-]*%20tested-blue/%20${NEW}%20pending-yellow/" README.md
# Latest tested: update version on the TRACKER:LATEST-TESTED line
sed -i "/TRACKER:LATEST-TESTED/s/Gitea [0-9.]*/Gitea ${NEW}/" README.md
- name: README translations — latest tested
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
for f in docs/README.zh-CN.md; do
sed -i "/TRACKER:LATEST-TESTED/s/Gitea [0-9.]*/Gitea ${NEW}/" "$f"
done
- name: Create Pull Request - name: Create Pull Request
if: steps.version.outputs.skip != 'true' if: steps.version.outputs.skip != 'true'
@@ -117,7 +99,7 @@ jobs:
This PR: This PR:
- Updates the compatibility matrix in `COMPATIBILITY.md` - Updates the compatibility matrix in `COMPATIBILITY.md`
- Updates version badges in `README.md` and translations - Marks the new version as pending in the `README.md` badge
- Marks the new version as **⏳ Pending Verification** - Marks the new version as **⏳ Pending Verification**
## Verification Checklist ## Verification Checklist
@@ -126,12 +108,13 @@ jobs:
- [ ] Run `cd tools && go run . preview all` to confirm templates still render - [ ] Run `cd tools && go run . preview all` to confirm templates still render
- [ ] Update status from ⏳ to ✅ (compatible) or ❌ (breaking) in COMPATIBILITY.md - [ ] Update status from ⏳ to ✅ (compatible) or ❌ (breaking) in COMPATIBILITY.md
- [ ] Update the `Mail Template Changes` and `Breaking?` columns with accurate notes - [ ] Update the `Mail Template Changes` and `Breaking?` columns with accurate notes
- [ ] After verification, update `TRACKER:LATEST-VERIFIED` and the English/Chinese `TRACKER:LATEST-TESTED` lines; switch the README badge from pending to tested
## Semantic tracking ## Semantic tracking
Once verified, update the tracked Gitea version (release numbers stay unchanged): Once verified, update the tracked Gitea version:
- [ ] Update the parenthesized Gitea version on the active **Template Release** row in `COMPATIBILITY.md` (e.g. `v1.0.1(v${{ steps.version.outputs.new_version }})`) - [ ] Keep the top **Template Release** row as `Unreleased` until its fixes are tagged; never label a released archive compatible with unshipped changes
- [ ] Update the README release line and badge to the new version - [ ] Update the README release status and compatibility matrix to distinguish source fixes from published packages
- [ ] Tag a new release only if the template content itself changed — `git tag vX.Y.Z && git push origin vX.Y.Z` (the release workflow packages automatically) - [ ] Tag a new release when shipping template fixes — `git tag vX.Y.Z && git push origin vX.Y.Z` (the release workflow packages automatically)
labels: compatibility, automated labels: compatibility, automated
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+3 -3
View File
@@ -66,9 +66,9 @@ docs/ # Bilingual documentation (English + Simplified Chinese)
## Versioning ## Versioning
- Release numbers stay on the project's own scheme; the supported Gitea version is appended in parentheses — `v1.0.1(v1.27.2)` means release `v1.0.1` tracks Gitea `1.27.2` - Release tags identify actual downloadable packages; the compatibility matrix distinguishes released tags from source-only fixes
- The current release is **v1.0.1** (tracks Gitea 1.27.2); the quick-reference table in `COMPATIBILITY.md` lists it first — the tracker workflow updates that row by position - The current published release is **v1.27.2**; it has a push-notification bug in Bloom, Ember, and Heritage on Gitea 1.27.1+. The current source tree fixes it and is verified against Gitea 1.27.3. The quick-reference table in `COMPATIBILITY.md` lists the unreleased row first; the tracker workflow updates that row by position
- When a new Gitea version is verified compatible: update the parenthesized Gitea version in the active `COMPATIBILITY.md` row, plus the README release line and badge - When a new Gitea version is checked: update the top `COMPATIBILITY.md` row and README badge; keep unreleased fixes distinct from the published release, and update verified/tested wording only after verification
- Tag a new release (`vX.Y.Z`) only when the template content itself changes — the release workflow packages automatically on tag push - Tag a new release (`vX.Y.Z`) only when the template content itself changes — the release workflow packages automatically on tag push
- Keep the `TRACKER:` markers in `COMPATIBILITY.md` / `README.md` adjacent to their rows so the automated workflow keeps parsing them - Keep the `TRACKER:` markers in `COMPATIBILITY.md` / `README.md` adjacent to their rows so the automated workflow keeps parsing them
+13 -9
View File
@@ -7,23 +7,26 @@ This document tracks the compatibility between **Gitea Mail Templates** releases
<!-- TRACKER:QUICK-REF-MAX OFFSET=3 --> <!-- TRACKER:QUICK-REF-MAX OFFSET=3 -->
| Template Release | Min Gitea | Max Tested Gitea | Status | | Template Release | Min Gitea | Max Tested Gitea | Status |
|-----------------|-----------|-----------------|--------| |-----------------|-----------|-----------------|--------|
| **v1.0.1(v1.27.2)** | **1.25.0** | **1.27.2** | ✅ Active | | **Unreleased** | **1.25.0** | **1.27.3** | ✅ Source verified; release pending |
| **v1.27.2** | **1.25.0** | **1.27.3** | ⚠️ Push notices fail in Bloom, Ember, and Heritage on Gitea 1.27.1+ |
| **v1.0.1** | **1.25.0** | **1.27.0** | ✅ Superseded; push notices need newer release on 1.27.1+ |
| **v1.0.0** | **1.25.0** | **1.26.4** | ✅ Superseded | | **v1.0.0** | **1.25.0** | **1.26.4** | ✅ Superseded |
> **Latest verified:** All 11 templates pass validation against Gitea 1.27.2 data contexts. <!-- TRACKER:LATEST-VERIFIED --> > **Latest verified:** The current source tree passes the Gitea 1.27.3 source audit and push-render test. The published v1.27.2 archive still contains three broken push-notification templates. <!-- TRACKER:LATEST-VERIFIED -->
## Versioning ## Versioning
From **1.27.1** onward, template releases are **semantically tracked** against Gitea: the release keeps its own number, and the supported Gitea version is appended in parentheses — `v1.0.1(v1.27.2)` means release `v1.0.1` is the version to use with Gitea `1.27.2`. The release tag identifies the downloadable template package. The supported Gitea version may be appended in parentheses in this compatibility matrix; the parenthesized version is not a Git tag. An **Unreleased** row describes fixes in the source tree that are not yet in a downloadable release.
| Gitea version | Template release | | Gitea version | Template release |
|---------------|------------------| |---------------|------------------|
| 1.27.2 | **v1.0.1(v1.27.2)** | | 1.27.3 | **Unreleased fix**; published v1.27.2 has a push-notification issue in three themes |
| 1.27.1 | **v1.0.1(v1.27.1)** | | 1.27.2 | **Unreleased fix**; published v1.27.2 has the same issue |
| 1.27.1 | **Unreleased fix**; published v1.27.2 has the same issue |
- The [tracker workflow](.github/workflows/gitea-tracker.yml) opens a PR when a new Gitea release appears, marking it ⏳ Pending Verification. - The [tracker workflow](.github/workflows/gitea-tracker.yml) opens a PR when a new Gitea release appears, marking it ⏳ Pending Verification.
- After verification, update the parenthesized Gitea version on the active **Template Release** row. A new release (`vX.Y.Z`) is only tagged when the template content itself changes — the [release workflow](.github/workflows/release.yml) packages the archive automatically on tag push. - After verification, update the top **Template Release** row. Keep source-only fixes marked **Unreleased** until a new tag is published; the [release workflow](.github/workflows/release.yml) packages the archive on tag push.
- Releases before Gitea 1.27.1 predate semantic tracking and keep their plain version numbers in the matrix. - The older `v1.0.1` tag predates the Gitea 1.27.1 push notification data fix and should not be used for Gitea 1.27.1 or newer.
## Check Your Gitea Version ## Check Your Gitea Version
@@ -38,8 +41,9 @@ gitea --version
<!-- TRACKER:VERSION-INSERT OFFSET=2 --> <!-- TRACKER:VERSION-INSERT OFFSET=2 -->
| Gitea | Release Date | Mail Template Changes | Breaking? | | Gitea | Release Date | Mail Template Changes | Breaking? |
|-------|-------------|----------------------|-----------| |-------|-------------|----------------------|-----------|
| **1.27.3** | 2026-08-29 | No upstream mail template, mailer, or locale changes; an existing push-notification defect in three published themes was found and fixed in the current source tree | No upstream break (local fix pending release) |
| **1.27.2** | 2026-08-14 | None — security + bug fixes | No | | **1.27.2** | 2026-08-14 | None — security + bug fixes | No |
| **1.27.1** | 2026-07-27 | Fixed push commit data paths: .ID → .UserCommit.GitCommit.ID (#38467) | No | | **1.27.1** | 2026-07-27 | Push commit data paths changed: .ID → .UserCommit.GitCommit.ID (#38467); older custom templates can fail on push notifications | Yes (old .ID paths) |
| **1.27.0** | 2026-07-13 | None — no mail template changes | No | | **1.27.0** | 2026-07-13 | None — no mail template changes | No |
| **1.26.4** | 2026-06-21 | None — hotfix release | No | | **1.26.4** | 2026-06-21 | None — hotfix release | No |
| **1.26.3** | 2026-06-20 | None — security release | No | | **1.26.3** | 2026-06-20 | None — security release | No |
@@ -106,7 +110,7 @@ All templates use Gitea's official `mail.*` translation namespace. Keys are stab
## Automated Tracking ## Automated Tracking
A [workflow](.github/workflows/gitea-tracker.yml) runs daily (UTC 08:00) to detect new Gitea releases. When a new version is found, it automatically creates a PR updating the matrix and badges with a **⏳ Pending Verification** status. Manual trigger is also available via `workflow_dispatch`. Once verification passes, release the templates under the same version number (see [Versioning](#versioning)). A [workflow](.github/workflows/gitea-tracker.yml) runs daily (UTC 08:00) to detect new Gitea releases. When a new version is found, it automatically creates a PR updating the matrix and badges with a **⏳ Pending Verification** status. Manual trigger is also available via `workflow_dispatch`. Once verification passes, update the compatibility matrix; publish a new template tag when template changes require a release (see [Versioning](#versioning)).
## Reporting Issues ## Reporting Issues
+5 -5
View File
@@ -2,9 +2,9 @@
A curated collection of professionally designed, audience-driven email templates for self-hosted [Gitea](https://about.gitea.com) instances. A curated collection of professionally designed, audience-driven email templates for self-hosted [Gitea](https://about.gitea.com) instances.
[![Gitea](https://img.shields.io/badge/Gitea-1.25+%20%7C%201.27.2%20tested-blue)](COMPATIBILITY.md) <!-- TRACKER:BADGE --> [![Gitea](https://img.shields.io/badge/Gitea-1.25+%20%7C%201.27.3%20tested-blue)](COMPATIBILITY.md) <!-- TRACKER:BADGE -->
> **Release v1.0.1 — tracks Gitea 1.27.2 — 110 template files, 10 visual styles, 11 email types each** > **110 template files — 10 visual styles, 11 email types each. Current source verified with Gitea 1.27.3; push-notification fixes await a new release.**
--- ---
@@ -164,9 +164,9 @@ gitea-mail-templates/
## Compatibility ## Compatibility
- **Gitea 1.25+** — matches the refactored mail template directory structure (v1.25) - **Gitea 1.25+** — matches the refactored mail template directory structure (v1.25)
- **Latest tested:** Gitea 1.27.2 <!-- TRACKER:LATEST-TESTED --> - **Latest tested:** Gitea 1.27.3 <!-- TRACKER:LATEST-TESTED -->
- **Versioning:** releases are semantically tracked — Gitea 1.27.2 → template release v1.0.1(v1.27.2) (see [COMPATIBILITY.md](COMPATIBILITY.md)) - **Published release:** v1.27.2. Its Bloom, Ember, and Heritage push notifications can fail on Gitea 1.27.1+; the fix is in the current source tree and awaits release (see [COMPATIBILITY.md](COMPATIBILITY.md))
- 100% variable-compatible with official Gitea templates — see [COMPATIBILITY.md](COMPATIBILITY.md) for the full matrix - The current source uses Gitea's official template data paths — see [COMPATIBILITY.md](COMPATIBILITY.md) for release-specific limitations
- Uses only built-in Gitea template functions and official translation keys - Uses only built-in Gitea template functions and official translation keys
- No custom template functions or locale patches required - No custom template functions or locale patches required
+3 -3
View File
@@ -79,9 +79,9 @@ cd tools && go run . dev
## 兼容性 ## 兼容性
- **Gitea 1.25+** — v1.25 引入的邮件模板目录结构 - **Gitea 1.25+** — v1.25 引入的邮件模板目录结构
- **最新测试:** Gitea 1.27.2<!-- TRACKER:LATEST-TESTED --> - **最新测试:** Gitea 1.27.3<!-- TRACKER:LATEST-TESTED -->
- **版本号:** 发布版本语义化追踪 Gitea 版本 — Gitea 1.27.2 → 模板发布版 v1.0.1(v1.27.2)(详见 [COMPATIBILITY.md](COMPATIBILITY.md)) - **发布状态:** 已发布的 v1.27.2 在 Gitea 1.27.1+ 上,Bloom、Ember、Heritage 主题的推送通知可能失败;当前源码已修复,尚待发布(详见 [兼容性说明](../COMPATIBILITY.md))
- 与 Gitea 官方模板 100% 兼容 — 详见 [COMPATIBILITY.md](COMPATIBILITY.md) - 当前源码使用 Gitea 官方模板的数据路径;各发布版的限制详见 [兼容性说明](../COMPATIBILITY.md)
## 许可证 ## 许可证
+2 -2
View File
@@ -124,8 +124,8 @@
<ul class="commit-list"> <ul class="commit-list">
{{range .Comment.Commits}} {{range .Comment.Commits}}
<li class="commit-item"> <li class="commit-item">
<a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/commit/{{.ID}}" class="commit-link"> <a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/commit/{{.UserCommit.GitCommit.ID}}" class="commit-link">
{{ShortSha .ID.String}} {{ShortSha .UserCommit.GitCommit.ID.String}}
</a> &mdash; {{.UserCommit.GitCommit.MessageTitle}} </a> &mdash; {{.UserCommit.GitCommit.MessageTitle}}
</li> </li>
{{end}} {{end}}
+2 -2
View File
@@ -129,8 +129,8 @@
<ul class="commit-list"> <ul class="commit-list">
{{range .Comment.Commits}} {{range .Comment.Commits}}
<li class="commit-item"> <li class="commit-item">
<a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/commit/{{.ID}}" class="commit-link"> <a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/commit/{{.UserCommit.GitCommit.ID}}" class="commit-link">
{{ShortSha .ID.String}} {{ShortSha .UserCommit.GitCommit.ID.String}}
</a> &mdash; {{.UserCommit.GitCommit.MessageTitle}} </a> &mdash; {{.UserCommit.GitCommit.MessageTitle}}
</li> </li>
{{end}} {{end}}
+2 -2
View File
@@ -122,8 +122,8 @@
<ul class="commit-list"> <ul class="commit-list">
{{range .Comment.Commits}} {{range .Comment.Commits}}
<li class="commit-item"> <li class="commit-item">
<a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/commit/{{.ID}}" class="commit-link"> <a href="{{$.Comment.Issue.PullRequest.BaseRepo.HTMLURL}}/commit/{{.UserCommit.GitCommit.ID}}" class="commit-link">
{{ShortSha .ID.String}} {{ShortSha .UserCommit.GitCommit.ID.String}}
</a> &mdash; {{.UserCommit.GitCommit.MessageTitle}} </a> &mdash; {{.UserCommit.GitCommit.MessageTitle}}
</li> </li>
{{end}} {{end}}
+67
View File
@@ -0,0 +1,67 @@
package preview
import (
"html/template"
"os"
"path/filepath"
"strings"
"testing"
"gitea-mail-templates/tools/config"
)
type testCommitID string
func (id testCommitID) String() string { return string(id) }
// Exercise the push-only branch with Gitea's nested commit data shape.
// The normal preview fixture has no commits, so it cannot catch stale .ID paths.
func TestPushCommitTemplates(t *testing.T) {
cfg, err := config.Load(filepath.Join("..", "data", "templates_config.json"))
if err != nil {
t.Fatal(err)
}
const sha = "0123456789abcdef0123456789abcdef01234567"
data := cfg.Templates["default"].Params
data["ActionName"] = "push"
data["locale"] = Locale{}
comment := data["Comment"].(map[string]any)
comment["Commits"] = []any{map[string]any{
"UserCommit": map[string]any{
"GitCommit": map[string]any{
"ID": testCommitID(sha),
"MessageTitle": "Test push commit",
},
},
}}
markSafeHTML(data)
themesDir := filepath.Join("..", "..", "themes")
themes, err := os.ReadDir(themesDir)
if err != nil {
t.Fatal(err)
}
for _, theme := range themes {
if !theme.IsDir() {
continue
}
t.Run(theme.Name(), func(t *testing.T) {
path := filepath.Join(themesDir, theme.Name(), "mail", "repo", "issue", "default.tmpl")
content, err := os.ReadFile(path)
if err != nil {
t.Fatal(err)
}
tmpl, err := template.New("push").Funcs(TemplateFuncs).Parse(string(content))
if err != nil {
t.Fatal(err)
}
var html strings.Builder
if err := tmpl.Execute(&html, data); err != nil {
t.Fatal(err)
}
if !strings.Contains(html.String(), "/commit/"+sha) || !strings.Contains(html.String(), sha[:10]) {
t.Fatal("push commit link or abbreviated hash missing from rendered email")
}
})
}
}