mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-05-07 12:37:43 -05:00
[PR #266] [MERGED] fix: prevent duplicate issue/PR mirroring, enforce release retention, and fix public repo auth #1363
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/266
Author: @arunavo4
Created: 4/13/2026
Status: ✅ Merged
Merged: 4/16/2026
Merged by: @arunavo4
Base:
main← Head:fix/mirror-sync-bugs-262-263-264📝 Commits (2)
d3ce63bfix: prevent duplicate issue/PR mirroring, enforce release retention, and fix public repo auth (#262, #263, #264)fdf56c6fix: preserve backup settings in env config loader (#267)📊 Changes
6 files changed (+120 additions, -20 deletions)
View changed files
📝
src/lib/env-config-loader.ts(+7 -0)📝
src/lib/gitea-enhanced.test.ts(+4 -3)📝
src/lib/gitea-enhanced.ts(+21 -2)📝
src/lib/gitea.ts(+75 -5)📝
src/lib/utils/mirror-source-auth.test.ts(+7 -7)📝
src/lib/utils/mirror-source-auth.ts(+6 -3)📄 Description
Summary
Fixes three reported mirror sync bugs:
#262 — Duplicate issues/PRs created on every sync: Added
!metadataState.components.issuesand!metadataState.components.pullRequestsguards tosyncGiteaRepoEnhanced, matching the existing pattern used by labels and milestones. Without these guards, every sync re-mirrored all issues/PRs, creating duplicates that compounded over time. Users can still re-trigger via "Re-run Metadata" which resets the metadata state.#264 — Release retention limit not enforced: Two fixes:
httpPut→httpPatchfor Gitea release updates — the Gitea/Forgejo API uses PATCH, not PUT, causing silent HTTP 405 errors on every release update.releaseLimit.#263 — Repos not syncing after initial mirror (Forgejo): Removed the
if (repository.isPrivate)guard aroundbuildGithubSourceAuthPayloadso auth credentials are always sent during migration. This prevents Forgejo's "terminal prompts disabled" error on subsequent fetches for public repos. Also added missingservice: "git"to the org migration payload for consistency.Supporting changes
buildGithubSourceAuthPayloadnow returns{}instead of throwing when token is missing, allowing unconditional usesyncGiteaRepoEnhanceddocumenting that Gitea/Forgejo's PATCH repo API does not support updating mirror credentials — repos migrated without credentials must be deleted and re-mirroredTest plan
buildGithubSourceAuthPayload(expects{}return instead of throw)releaseLimitafter syncCloses #262, closes #263, closes #264
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.