ci: add Gitea version tracker workflow with auto-PR creation

- Daily cron + repository_dispatch webhook + manual workflow_dispatch
- Fetches latest Gitea release via API, compares with current max tested
- On new version: updates COMPATIBILITY.md matrix, README badges (all 6
  languages), creates PR with verification checklist
- Webhook setup instructions in COMPATIBILITY.md
- Uses peter-evans/create-pull-request for PR automation

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
KenanZhuandClaude committed 2026-06-23 10:28:54 +08:00
1 parent 2f27d54251
commit 15509e01ac
2 files changed
+140

No files matched your search

+118
View File
@@ -0,0 +1,118 @@
name: Gitea Version Tracker
on:
schedule:
# Daily at 08:00 UTC — check for new Gitea releases
- cron: '0 8 * * *'
repository_dispatch:
types: [gitea-release]
workflow_dispatch:
inputs:
version:
description: 'Gitea version (e.g. 1.27.0) — leave empty to auto-detect'
required: false
jobs:
track:
name: Track Gitea Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Determine latest Gitea version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
NEW_VERSION="${{ github.event.inputs.version }}"
else
# Fetch latest release from Gitea API
RELEASE_JSON=$(curl -sSf https://gitea.com/api/v1/repos/gitea/gitea/releases/latest)
NEW_VERSION=$(echo "$RELEASE_JSON" | jq -r '.tag_name')
fi
echo "New Gitea version: $NEW_VERSION"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
# Parse current max tested from COMPATIBILITY.md
CURRENT=$(grep -oP 'Max Tested Gitea.*?\|\s*\*\*\K[0-9.]+' COMPATIBILITY.md)
echo "Current max tested: $CURRENT"
echo "current_version=$CURRENT" >> $GITHUB_OUTPUT
if [ "$NEW_VERSION" = "$CURRENT" ]; then
echo "No new Gitea release detected. Skipping."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "New version detected: $CURRENT → $NEW_VERSION"
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Update COMPATIBILITY.md — Quick Reference
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
sed -i "s/|\*\*\([0-9.]*\)\*\* | \*\*[0-9.]*\*\* |/\|\*\*\1\*\* | \*\*${NEW}\*\* |/" COMPATIBILITY.md
- name: Update COMPATIBILITY.md — Version History table
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
TODAY=$(date +%Y-%m-%d)
# Insert new row after the table header (line with "|---|---")
ROW="| **${NEW}** | ${TODAY} | ⏳ Pending Verification | TBD |"
sed -i "/^|---/a ${ROW}" COMPATIBILITY.md
- name: Update COMPATIBILITY.md — latest verified note
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
# Update the "Latest verified" note
sed -i "s/Gitea [0-9.]* data contexts/Gitea ${NEW} data contexts/" COMPATIBILITY.md
- name: Update README.md badge
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
# Update the shields.io badge
sed -i "s/\(tested\)-[0-9a-z.]*\(blue\)/\1-${NEW}\2/" README.md
# Update the "Latest tested" line
sed -i "s/Latest tested:\*\* Gitea [0-9.]*/Latest tested:** Gitea ${NEW}/" README.md
- name: Update README translations
if: steps.version.outputs.skip != 'true'
run: |
NEW="${{ steps.version.outputs.new_version }}"
for f in docs/README.{ja,ko,ru,zh-CN,zh-TW}.md; do
# Update version number in the compatibility section
sed -i "s/テスト:\*\* Gitea [0-9.]*/テスト:** Gitea ${NEW}/" "$f"
sed -i "s/테스트:\*\* Gitea [0-9.]*/테스트:** Gitea ${NEW}/" "$f"
sed -i "s/проверка:\*\* Gitea [0-9.]*/проверка:** Gitea ${NEW}/" "$f"
sed -i "s/测试:\*\* Gitea [0-9.]*/测试:** Gitea ${NEW}/" "$f"
sed -i "s/測試:\*\* Gitea [0-9.]*/測試:** Gitea ${NEW}/" "$f"
done
- name: Create Pull Request
if: steps.version.outputs.skip != 'true'
uses: peter-evans/create-pull-request@v7
with:
branch: track/gitea-${{ steps.version.outputs.new_version }}
commit-message: "docs: track Gitea ${{ steps.version.outputs.new_version }} — pending verification"
title: "⬆️ Track Gitea ${{ steps.version.outputs.new_version }} — ⏳ Pending Verification"
body: |
Gitea **${{ steps.version.outputs.new_version }}** has been released.
This PR:
- Updates the compatibility matrix in `COMPATIBILITY.md`
- Updates version badges in `README.md` and translations
- Marks the new version as **⏳ Pending Verification**
## Verification Checklist
- [ ] Check [Gitea changelog](https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md) for mail template changes
- [ ] Review diff of official templates: `git diff v${{ steps.version.outputs.current_version }}..v${{ steps.version.outputs.new_version }} -- templates/mail/ services/mailer/`
- [ ] Run `cd tools && go run . preview all` to confirm templates still render
- [ ] Update status from ⏳ to ✅ (compatible) or ❌ (breaking) in COMPATIBILITY.md
- [ ] Update the `Mail Template Changes` and `Breaking?` columns with accurate notes
labels: compatibility, automated
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+22
View File
@@ -85,6 +85,28 @@ All templates use Gitea's official `mail.*` translation namespace. Keys are stab
2. **Source audit** — Template data contexts are cross-referenced against Gitea's `services/mailer/` package
3. **Release checklist** — Each release confirms the max-tested Gitea version in this file
## Automated Tracking
A [workflow](.github/workflows/gitea-tracker.yml) runs daily (and on-demand) 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.
### Webhook Setup (optional)
To trigger the tracker immediately when Gitea publishes a release, configure a webhook on your Gitea instance:
1. Go to **Site Administration → System Webhooks**
2. Add a webhook with the type **Send Everything**
3. Set URL to:
```
https://api.github.com/repos/<YOUR_USER>/gitea-mail-templates/dispatches/gitea-release
```
4. Set **Authorization** header with a [GitHub PAT](https://github.com/settings/tokens) that has `repo` scope:
```
Authorization: Bearer ghp_xxxxxxxxxxxx
```
5. Content type: `application/json`
> The tracker also runs daily via cron (`0 8 * * *` UTC), so manual webhook setup is optional.
## Reporting Issues
If you find a compatibility problem with a specific Gitea version: