mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-11-16 14:45:02 -06:00
[PR #370] [MERGED] feat(mirror): per-repo release limit, description sync on every sync, tidier mobile cards #8976
Reference in New Issue
Block a user
📋 Pull Request Information
Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/370
Author: @arunavo4
Created: 8/24/2026
Status: ✅ Merged
Merged: 8/24/2026
Merged by: @arunavo4
Base:
main← Head:feat/361-followups📝 Commits (1)
c1282d7feat(mirror): per-repo release limit, description sync on every sync, tidier mobile cards📊 Changes
9 files changed (+1094 additions, -143 deletions)
View changed files
📝
src/components/config/MirrorOverridesDialog.tsx(+144 -42)📝
src/components/repositories/RepositoryTable.tsx(+57 -41)📝
src/lib/db/schema.ts(+10 -2)📝
src/lib/gitea-enhanced.test.ts(+78 -0)📝
src/lib/gitea-enhanced.ts(+33 -0)➕
src/lib/gitea-repo-metadata.test.ts(+335 -0)📝
src/lib/gitea.ts(+136 -38)📝
src/lib/utils/mirror-overrides.test.ts(+205 -2)📝
src/lib/utils/mirror-overrides.ts(+96 -18)📄 Description
Follow-up to #362 and #365, covering the three points @MMMMMoris raised in https://github.com/RayLabsHQ/gitea-mirror/issues/361#issuecomment-5377981716.
1. Releases and tags
To answer the question first: tags are not something we mirror ourselves. Gitea's own git mirror fetches every ref from upstream, tags included, so they arrive with the code on every pull and there is no per-repo control over them. They also cost nothing extra to store, a tag is a pointer to a commit that is already in the clone. Releases are different. We create them through the Gitea API on top of tags that already exist in the mirror, and the release assets are where the disk usage comes from. There is already a global "latest N releases" setting (default 10), and the release mirror prunes anything in Gitea beyond it.
So a "max tags" option does not apply, but a per-repo and per-org release limit does. This PR adds it:
releaseLimitjoinsmirrorOverrideson repositories and organizations, with the same precedence as the flags: repo, then org, then global, then the default of 10. It is the one non-boolean override, so it sits next toMIRROR_OVERRIDE_KEYSrather than inside it, and the resolver returns it as a definite positive integer.mirrorGitHubReleasesToGiteatakes the resolved limit from its three callers and resolves it itself when a caller does not pass one, so direct callers honor the overrides too.2. Repository description
The description was already being sent to Gitea at migration time (#224), but only from the value stored in our own database, and only once. Two ways to end up with a blank description in Gitea: the repository was imported before #224 shipped (the bulk import only inserts new rows and never refreshes existing ones, so those rows have no description to send), or the upstream description changed after the mirror was created. Neither case ever recovered, because the sync path did not touch the description at all.
Now
syncRepositoryMetadataToGitearuns on every sync as well as after migration, and reads the description and topics straight from GitHub.GET /repos/{owner}/{repo}carries both, so it replaces the topics-only call rather than adding one. GitHub is authoritative when reachable. The stored value is only a fallback for the no-token and GitHub-down cases, and an empty fallback is never written, so an outage cannot wipe a description Gitea already has. The refreshed description is written back to our row as well. Writes are skipped when Gitea already holds the same values, using the repo info the sync path fetches anyway, and the GitHub client's ETag layer turns the per-sync re-check into a 304 that does not count against the rate limit when nothing changed.Existing mirrors pick the description up on their next sync, no re-mirror needed.
One behaviour change to be aware of: the sync path used to never touch the description, now it keeps it equal to GitHub's. If someone edited a mirror's description by hand in Gitea, the next sync puts the GitHub one back. That is the mirror semantics topics already follow.
3. Mobile repository card
Layout reworked along the lines of the mock-ups in the comment:
Custombadge and the menu share one vertically centred row, so the name sits at the same height whether or not the badge is present. That was the misalignment in the last screenshot: the checkbox, the name and the menu button each had a different centre line.Same field in the organization dialog on desktop:
Verification
bun test: 533 pass, 0 fail. 30 new tests: resolver precedence and helpers for the limit, the release-limit gating,syncRepositoryMetadataToGiteain isolation (GitHub wins, fallback paths, skip-when-unchanged, outage never wipes, prefix handling), and the sync path both calling the metadata sync and passing the resolved limit through.bunx --bun astro buildclean.{"lfs":false,"releaseLimit":5}, releases-off disables the limit with a reason,0blocks Save, and an org-level limit shows up as the repository's inherited hint.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.