mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-07-22 11:38:40 -05:00
[PR #327] [MERGED] feat(github): add organization allowlist to mirror only selected orgs #6924
Reference in New Issue
Block a user
📋 Pull Request Information
Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/327
Author: @arunavo4
Created: 6/19/2026
Status: ✅ Merged
Merged: 6/19/2026
Merged by: @arunavo4
Base:
main← Head:feat/org-include-allowlist📝 Commits (1)
0e50f8bfeat(github): add organization allowlist to mirror only selected orgs📊 Changes
8 files changed (+244 additions, -9 deletions)
View changed files
📝
docs/ENVIRONMENT_VARIABLES.md(+1 -0)📝
src/components/config/GitHubMirrorSettings.tsx(+91 -0)📝
src/lib/env-config-loader.ts(+8 -1)📝
src/lib/github-affiliation.test.ts(+89 -0)📝
src/lib/github.ts(+22 -1)📝
src/lib/repository-cleanup-service.ts(+11 -5)📝
src/lib/utils/config-mapper.ts(+21 -2)📝
src/types/config.ts(+1 -0)📄 Description
Problem
Repository discovery requested the
organization_memberaffiliation unconditionally, so repos from every org a user belongs to were imported — even orgs they never explicitly added.skipPersonalReposonly dropped user-owned repos and left org repos unfiltered.This surprised users who expected "skip personal repos / only mirror org repos" to mean "only the orgs I chose." Reported on #304 (follow-up to the v3.18.0
skipPersonalRepostoggle):Fix
Wire up the previously-dormant
includeOrganizationsconfig field as an opt-in allowlist:skipPersonalRepos.This is opt-in and complementary to the existing per-org Ignore action (#323, opt-out) — users in many orgs can now pick a small set to mirror instead of ignoring everything else one by one.
Changes
getGithubRepositories: filter org-owned repos by the allowlist.includeAllOrgsOverrideflag sorepository-cleanup-servicebypasses the allowlist and never false-orphans (archive/delete) a previously-mirrored repo from an org the user later removes from the list — same guard pattern as the existingincludeCollaboratorReposOverride.INCLUDE_ORGANIZATIONS(comma-separated).skipPersonalRepos, blank handling, cleanup override).Testing
CI-equivalent run on a clean checkout (
bun test346 pass /bun test:migrations/astro build) all green.Live end-to-end discovery against a real multi-org account:
[OrgA]Closes the org-membership gap discussed in #304.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.