[PR #320] [MERGED] feat(github): add skipPersonalRepos toggle to mirror only org repos #4667

Closed
opened 2026-06-13 07:26:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/320
Author: @arunavo4
Created: 6/12/2026
Status: Merged
Merged: 6/13/2026
Merged by: @arunavo4

Base: mainHead: feat/304-skip-personal-repos


📝 Commits (1)

  • 33b5a46 feat(github): add skipPersonalRepos toggle to mirror only org repos (#304)

📊 Changes

9 files changed (+150 additions, -11 deletions)

View changed files

📝 docs/ENVIRONMENT_VARIABLES.md (+1 -1)
📝 src/components/config/GitHubMirrorSettings.tsx (+20 -0)
📝 src/lib/db/schema.ts (+3 -0)
📝 src/lib/env-config-loader.ts (+2 -0)
📝 src/lib/github-affiliation.test.ts (+75 -9)
📝 src/lib/github.ts (+12 -1)
📝 src/lib/utils/config-mapper.test.ts (+34 -0)
📝 src/lib/utils/config-mapper.ts (+2 -0)
📝 src/types/config.ts (+1 -0)

📄 Description

Fixes #304 (the "disable personal-repo import" half; mirroring arbitrary external user accounts is tracked separately, see #221).

Problem

Repo discovery always imports the authenticated user's personal repos (the owner affiliation is part of every discovery call), so users who only want manually-added external orgs had to manually ignore their own repos after every import cycle.

Change

  • New githubConfig.skipPersonalRepos (default false, no migration needed — JSON blob config). When enabled, getGithubRepositories drops repos owned by the authenticated user (owner.login matches the configured username AND owner.type === "User"), keeping org repos and collaborator repos. Starred-repo discovery is unaffected.
  • Settings UI checkbox: "Skip personal repositories (only mirror organization repos)".
  • The ONLY_MIRROR_ORGS env var was previously parsed and silently dropped (dead); it now maps to skipPersonalRepos: true. Docs updated.
  • The unused top-level include/exclude config arrays are now annotated as reserved (they have never been read by any code path).

Testing

10 new unit tests (filter behavior incl. collaborator/org preservation and empty-login safety, config-mapper round-trip, env mapping). Full suite green.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/RayLabsHQ/gitea-mirror/pull/320 **Author:** [@arunavo4](https://github.com/arunavo4) **Created:** 6/12/2026 **Status:** ✅ Merged **Merged:** 6/13/2026 **Merged by:** [@arunavo4](https://github.com/arunavo4) **Base:** `main` ← **Head:** `feat/304-skip-personal-repos` --- ### 📝 Commits (1) - [`33b5a46`](https://github.com/RayLabsHQ/gitea-mirror/commit/33b5a46af9118713177030eb6098516271bcd5e7) feat(github): add skipPersonalRepos toggle to mirror only org repos (#304) ### 📊 Changes **9 files changed** (+150 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `docs/ENVIRONMENT_VARIABLES.md` (+1 -1) 📝 `src/components/config/GitHubMirrorSettings.tsx` (+20 -0) 📝 `src/lib/db/schema.ts` (+3 -0) 📝 `src/lib/env-config-loader.ts` (+2 -0) 📝 `src/lib/github-affiliation.test.ts` (+75 -9) 📝 `src/lib/github.ts` (+12 -1) 📝 `src/lib/utils/config-mapper.test.ts` (+34 -0) 📝 `src/lib/utils/config-mapper.ts` (+2 -0) 📝 `src/types/config.ts` (+1 -0) </details> ### 📄 Description Fixes #304 (the "disable personal-repo import" half; mirroring arbitrary external user accounts is tracked separately, see #221). ## Problem Repo discovery always imports the authenticated user's personal repos (the `owner` affiliation is part of every discovery call), so users who only want manually-added external orgs had to manually ignore their own repos after every import cycle. ## Change - New `githubConfig.skipPersonalRepos` (default `false`, no migration needed — JSON blob config). When enabled, `getGithubRepositories` drops repos owned by the authenticated user (`owner.login` matches the configured username AND `owner.type === "User"`), keeping org repos and collaborator repos. Starred-repo discovery is unaffected. - Settings UI checkbox: "Skip personal repositories (only mirror organization repos)". - The `ONLY_MIRROR_ORGS` env var was previously parsed and silently dropped (dead); it now maps to `skipPersonalRepos: true`. Docs updated. - The unused top-level `include`/`exclude` config arrays are now annotated as reserved (they have never been read by any code path). ## Testing 10 new unit tests (filter behavior incl. collaborator/org preservation and empty-login safety, config-mapper round-trip, env mapping). Full suite green. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-13 07:26:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#4667