diff --git a/CHANGELOG.md b/CHANGELOG.md index 84fcd0d..5f36114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to the Gitea Mirror project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed +- Mirror strategies now properly route repositories based on selected strategy +- Starred repositories now correctly go to the designated starred repos organization +- Organization routing for single-org and flat-user strategies + +### Improved +- Documentation now explains all three mirror strategies (preserve, single-org, flat-user) +- Added detailed mirror strategy configuration guide +- Updated CLAUDE.md with mirror strategy architecture information + ## [2.13.2] - 2025-06-15 ### Improved diff --git a/CLAUDE.md b/CLAUDE.md index 960029f..757b521 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -79,6 +79,13 @@ export async function POST({ request }: APIContext) { - Tracks status in database - Supports scheduled automatic mirroring +6. **Mirror Strategies**: Three ways to organize repositories in Gitea: + - **preserve**: Maintains GitHub structure (default) + - **single-org**: All repos go to one organization + - **flat-user**: All repos go under user account + - Starred repos always go to separate organization (starredReposOrg) + - Routing logic in `getGiteaRepoOwner()` function + ### Database Schema (SQLite) - `users` - User accounts and authentication - `configs` - GitHub/Gitea connection settings diff --git a/README.md b/README.md index d6ce492..a6eab35 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ See the [LXC Container Deployment Guide](scripts/README-lxc.md). ## ✨ Features - 🔁 Sync public, private, or starred GitHub repos to Gitea -- đŸĸ Mirror entire organizations with structure preservation +- đŸĸ Mirror entire organizations with flexible organization strategies - 🐞 Optional mirroring of issues and labels -- 🌟 Mirror your starred repositories +- 🌟 Mirror your starred repositories to a dedicated organization - đŸ•šī¸ Modern user interface with toast notifications and smooth experience - 🧠 Smart filtering and job queue with detailed logs - đŸ› ī¸ Works with personal access tokens (GitHub + Gitea) @@ -317,6 +317,28 @@ Key configuration options include: > [!IMPORTANT] > **SQLite is the only database required for Gitea Mirror**, handling both data storage and real-time event notifications. +### Mirror Strategies + +Gitea Mirror offers three flexible strategies for organizing your repositories in Gitea: + +#### 1. **Preserve GitHub Structure** (Default) +- Personal repositories → Your Gitea username +- Organization repositories → Same organization name in Gitea +- Maintains the exact structure from GitHub + +#### 2. **Single Organization** +- All repositories → One designated organization +- Simplifies management by consolidating everything +- Requires specifying a destination organization name + +#### 3. **Flat User Structure** +- All repositories → Your Gitea user account +- No organizations needed +- Simplest approach for personal use + +> [!NOTE] +> **Starred Repositories**: Regardless of the chosen strategy, starred repositories are always mirrored to a separate organization (default: "starred") to keep them organized separately from your own repositories. + ## 🚀 Development ### Local Development Setup diff --git a/src/pages/docs/configuration.astro b/src/pages/docs/configuration.astro index 081eae5..2b1a8ab 100644 --- a/src/pages/docs/configuration.astro +++ b/src/pages/docs/configuration.astro @@ -18,7 +18,6 @@ const githubOptions = [ { name: 'Mirror Wiki', desc: 'Mirror wiki pages from GitHub to Gitea', default: 'false' }, { name: 'Mirror Organizations', desc: 'Mirror organization repositories', default: 'false' }, { name: 'Only Mirror Orgs', desc: 'Only mirror organization repositories', default: 'false' }, - { name: 'Preserve Org Structure', desc: 'Maintain organization structure in Gitea', default: 'false' }, { name: 'Skip Forks', desc: 'Exclude repositories that are forks', default: 'false' }, { name: 'Skip Starred Issues', desc: 'Skip issues for starred repositories', default: 'false' } ]; @@ -249,6 +248,74 @@ const giteaOptions = [ + +
+

Mirror Strategies

+

Choose how your repositories will be organized in Gitea:

+ +
+
+
+ 📁 + Preserve GitHub Structure +
+

Maintains the exact structure from GitHub:

+
    +
  • + â€ĸ + Personal repos → Your Gitea username +
  • +
  • + â€ĸ + Organization repos → Same organization name in Gitea +
  • +
+
+ +
+
+ đŸĸ + Single Organization +
+

Consolidates all repositories into one organization:

+
    +
  • + â€ĸ + All repos → One designated organization +
  • +
  • + â€ĸ + Requires setting "Organization" field +
  • +
+
+ +
+
+ 👤 + Flat User Structure +
+

Mirrors all repositories under your user account:

+
    +
  • + â€ĸ + All repos → Your Gitea username +
  • +
  • + â€ĸ + No organizations needed +
  • +
+
+
+ +
+

+ Note: Starred repositories are always mirrored to the "Starred Repos Org" (default: "starred") regardless of the chosen strategy. +

+
+
+
To create a Gitea access token: