diff --git a/.github/ci/values-ci.yaml b/.github/ci/values-ci.yaml index ed3b034..8d96b3c 100644 --- a/.github/ci/values-ci.yaml +++ b/.github/ci/values-ci.yaml @@ -37,7 +37,7 @@ gitea-mirror: type: "personal" privateRepositories: true skipForks: false - skipStarredIssues: false + starredCodeOnly: false gitea: url: "https://gitea.example.com" token: "not-used-in-template" diff --git a/CLAUDE.md b/CLAUDE.md index df056b7..040a816 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -193,7 +193,7 @@ export async function POST({ request }: APIContext) { ### Advanced Options (UI Fields) - **skipForks**: Skip forked repositories (default: false) -- **skipStarredIssues**: Skip issues for starred repositories (default: false) - enables "Lightweight mode" for starred repos +- **starredCodeOnly**: Skip issues for starred repositories (default: false) - enables "Lightweight mode" for starred repos ### Repository Statuses Repositories can have the following statuses: diff --git a/helm/gitea-mirror/README.md b/helm/gitea-mirror/README.md index f4d663c..0e68588 100644 --- a/helm/gitea-mirror/README.md +++ b/helm/gitea-mirror/README.md @@ -175,7 +175,7 @@ These values populate a **ConfigMap** (non-secret) and a **Secret** (for tokens | `gitea-mirror.github.type` | `personal` | `GITHUB_TYPE` | | `gitea-mirror.github.privateRepositories` | `true` | `PRIVATE_REPOSITORIES` | | `gitea-mirror.github.skipForks` | `false` | `SKIP_FORKS` | -| `gitea-mirror.github.skipStarredIssues` | `false` | `SKIP_STARRED_ISSUES` | +| `gitea-mirror.github.starredCodeOnly` | `false` | `SKIP_STARRED_ISSUES` | | `gitea-mirror.github.mirrorStarred` | `false` | `MIRROR_STARRED` | ### Gitea diff --git a/helm/gitea-mirror/templates/configmap.yaml b/helm/gitea-mirror/templates/configmap.yaml index c9acfe7..9b149e0 100644 --- a/helm/gitea-mirror/templates/configmap.yaml +++ b/helm/gitea-mirror/templates/configmap.yaml @@ -18,7 +18,7 @@ data: PRIVATE_REPOSITORIES: {{ $gm.github.privateRepositories | quote }} MIRROR_STARRED: {{ $gm.github.mirrorStarred | quote }} SKIP_FORKS: {{ $gm.github.skipForks | quote }} - SKIP_STARRED_ISSUES: {{ $gm.github.skipStarredIssues | quote }} + SKIP_STARRED_ISSUES: {{ $gm.github.starredCodeOnly | quote }} # Gitea Config GITEA_URL: {{ $gm.gitea.url | quote }} GITEA_USERNAME: {{ $gm.gitea.username | quote }} diff --git a/helm/gitea-mirror/values.yaml b/helm/gitea-mirror/values.yaml index 41121c8..ba36eaa 100644 --- a/helm/gitea-mirror/values.yaml +++ b/helm/gitea-mirror/values.yaml @@ -126,7 +126,7 @@ gitea-mirror: privateRepositories: true mirrorStarred: false skipForks: false - skipStarredIssues: false + starredCodeOnly: false gitea: url: "" diff --git a/src/components/config/AdvancedOptionsForm.tsx b/src/components/config/AdvancedOptionsForm.tsx index 0d63eba..c319e17 100644 --- a/src/components/config/AdvancedOptionsForm.tsx +++ b/src/components/config/AdvancedOptionsForm.tsx @@ -67,21 +67,21 @@ export function AdvancedOptionsForm({
- handleChange("skipStarredIssues", Boolean(checked)) + handleChange("starredCodeOnly", Boolean(checked)) } />

- Skip mirroring issues and pull requests for starred repositories + Mirror only source code for starred repositories, skipping all metadata (issues, PRs, labels, milestones, wiki, releases)

diff --git a/src/components/config/ConfigTabs.tsx b/src/components/config/ConfigTabs.tsx index 64b8ed0..55b1d32 100644 --- a/src/components/config/ConfigTabs.tsx +++ b/src/components/config/ConfigTabs.tsx @@ -71,7 +71,7 @@ export function ConfigTabs() { }, advancedOptions: { skipForks: false, - skipStarredIssues: false, + starredCodeOnly: false, }, }); const { user } = useAuth(); diff --git a/src/components/config/GitHubMirrorSettings.tsx b/src/components/config/GitHubMirrorSettings.tsx index 6e52203..9c1821f 100644 --- a/src/components/config/GitHubMirrorSettings.tsx +++ b/src/components/config/GitHubMirrorSettings.tsx @@ -89,10 +89,10 @@ export function GitHubMirrorSettings({ // Calculate what content is included for starred repos const starredRepoContent = { code: true, // Always included - releases: !advancedOptions.skipStarredIssues && mirrorOptions.mirrorReleases, - issues: !advancedOptions.skipStarredIssues && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.issues, - pullRequests: !advancedOptions.skipStarredIssues && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.pullRequests, - wiki: !advancedOptions.skipStarredIssues && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.wiki, + releases: !advancedOptions.starredCodeOnly && mirrorOptions.mirrorReleases, + issues: !advancedOptions.starredCodeOnly && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.issues, + pullRequests: !advancedOptions.starredCodeOnly && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.pullRequests, + wiki: !advancedOptions.starredCodeOnly && mirrorOptions.mirrorMetadata && mirrorOptions.metadataComponents.wiki, }; const starredContentCount = Object.entries(starredRepoContent).filter(([key, value]) => key !== 'code' && value).length; @@ -168,7 +168,7 @@ export function GitHubMirrorSettings({ className="h-8 text-xs font-normal min-w-[140px] md:min-w-[140px] justify-between" > - {advancedOptions.skipStarredIssues ? ( + {advancedOptions.starredCodeOnly ? ( "Code only" ) : starredContentCount === 0 ? ( "Code only" @@ -206,8 +206,8 @@ export function GitHubMirrorSettings({
handleAdvancedChange('skipStarredIssues', !!checked)} + checked={advancedOptions.starredCodeOnly} + onCheckedChange={(checked) => handleAdvancedChange('starredCodeOnly', !!checked)} />
- {!advancedOptions.skipStarredIssues && ( + {!advancedOptions.starredCodeOnly && ( <>
diff --git a/src/lib/db/schema.ts b/src/lib/db/schema.ts index 0f0efcb..270855e 100644 --- a/src/lib/db/schema.ts +++ b/src/lib/db/schema.ts @@ -27,7 +27,7 @@ export const githubConfigSchema = z.object({ starredReposOrg: z.string().optional(), mirrorStrategy: z.enum(["preserve", "single-org", "flat-user", "mixed"]).default("preserve"), defaultOrg: z.string().optional(), - skipStarredIssues: z.boolean().default(false), + starredCodeOnly: z.boolean().default(false), starredDuplicateStrategy: z.enum(["suffix", "prefix", "owner-org"]).default("suffix").optional(), }); diff --git a/src/lib/env-config-loader.ts b/src/lib/env-config-loader.ts index ce503de..ead3e56 100644 --- a/src/lib/env-config-loader.ts +++ b/src/lib/env-config-loader.ts @@ -21,7 +21,7 @@ interface EnvConfig { mirrorOrganizations?: boolean; preserveOrgStructure?: boolean; onlyMirrorOrgs?: boolean; - skipStarredIssues?: boolean; + starredCodeOnly?: boolean; starredReposOrg?: string; mirrorStrategy?: 'preserve' | 'single-org' | 'flat-user' | 'mixed'; }; @@ -107,7 +107,7 @@ function parseEnvConfig(): EnvConfig { mirrorOrganizations: process.env.MIRROR_ORGANIZATIONS === 'true', preserveOrgStructure: process.env.PRESERVE_ORG_STRUCTURE === 'true', onlyMirrorOrgs: process.env.ONLY_MIRROR_ORGS === 'true', - skipStarredIssues: process.env.SKIP_STARRED_ISSUES === 'true', + starredCodeOnly: process.env.SKIP_STARRED_ISSUES === 'true', starredReposOrg: process.env.STARRED_REPOS_ORG, mirrorStrategy: process.env.MIRROR_STRATEGY as 'preserve' | 'single-org' | 'flat-user' | 'mixed', }, @@ -253,7 +253,7 @@ export async function initializeConfigFromEnv(): Promise { starredReposOrg: envConfig.github.starredReposOrg || existingConfig?.[0]?.githubConfig?.starredReposOrg || 'starred', mirrorStrategy, defaultOrg: envConfig.gitea.organization || existingConfig?.[0]?.githubConfig?.defaultOrg || 'github-mirrors', - skipStarredIssues: envConfig.github.skipStarredIssues ?? existingConfig?.[0]?.githubConfig?.skipStarredIssues ?? false, + starredCodeOnly: envConfig.github.starredCodeOnly ?? existingConfig?.[0]?.githubConfig?.starredCodeOnly ?? false, }; // Build Gitea config diff --git a/src/lib/gitea.test.ts b/src/lib/gitea.test.ts index aadffa3..64236fb 100644 --- a/src/lib/gitea.test.ts +++ b/src/lib/gitea.test.ts @@ -331,7 +331,7 @@ describe("getGiteaRepoOwner - Organization Override Tests", () => { excludeOrgs: [], mirrorPublicOrgs: false, publicOrgs: [], - skipStarredIssues: false, + starredCodeOnly: false, mirrorStrategy: "preserve" }, giteaConfig: { diff --git a/src/lib/gitea.ts b/src/lib/gitea.ts index fdc4f13..e3f03b8 100644 --- a/src/lib/gitea.ts +++ b/src/lib/gitea.ts @@ -423,9 +423,9 @@ export const mirrorGithubRepoToGitea = async ({ // Prepare migration payload // For private repos, use separate auth fields instead of embedding credentials in URL // This is required for Forgejo 12+ which rejects URLs with embedded credentials - // Skip wiki for starred repos if skipStarredIssues is enabled + // Skip wiki for starred repos if starredCodeOnly is enabled const shouldMirrorWiki = config.giteaConfig?.wiki && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); const migratePayload: any = { clone_addr: cloneAddress, @@ -461,11 +461,11 @@ export const mirrorGithubRepoToGitea = async ({ ); //mirror releases - // Skip releases for starred repos if skipStarredIssues is enabled + // Skip releases for starred repos if starredCodeOnly is enabled const shouldMirrorReleases = config.giteaConfig?.mirrorReleases && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Release mirroring check: mirrorReleases=${config.giteaConfig?.mirrorReleases}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorReleases=${shouldMirrorReleases}`); + console.log(`[Metadata] Release mirroring check: mirrorReleases=${config.giteaConfig?.mirrorReleases}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorReleases=${shouldMirrorReleases}`); if (shouldMirrorReleases) { try { @@ -484,11 +484,11 @@ export const mirrorGithubRepoToGitea = async ({ } // clone issues - // Skip issues for starred repos if skipStarredIssues is enabled + // Skip issues for starred repos if starredCodeOnly is enabled const shouldMirrorIssues = config.giteaConfig?.mirrorIssues && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Issue mirroring check: mirrorIssues=${config.giteaConfig?.mirrorIssues}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorIssues=${shouldMirrorIssues}`); + console.log(`[Metadata] Issue mirroring check: mirrorIssues=${config.giteaConfig?.mirrorIssues}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorIssues=${shouldMirrorIssues}`); if (shouldMirrorIssues) { try { @@ -507,11 +507,11 @@ export const mirrorGithubRepoToGitea = async ({ } // Mirror pull requests if enabled - // Skip pull requests for starred repos if skipStarredIssues is enabled + // Skip pull requests for starred repos if starredCodeOnly is enabled const shouldMirrorPullRequests = config.giteaConfig?.mirrorPullRequests && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Pull request mirroring check: mirrorPullRequests=${config.giteaConfig?.mirrorPullRequests}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorPullRequests=${shouldMirrorPullRequests}`); + console.log(`[Metadata] Pull request mirroring check: mirrorPullRequests=${config.giteaConfig?.mirrorPullRequests}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorPullRequests=${shouldMirrorPullRequests}`); if (shouldMirrorPullRequests) { try { @@ -530,11 +530,11 @@ export const mirrorGithubRepoToGitea = async ({ } // Mirror labels if enabled (and not already done via issues) - // Skip labels for starred repos if skipStarredIssues is enabled + // Skip labels for starred repos if starredCodeOnly is enabled const shouldMirrorLabels = config.giteaConfig?.mirrorLabels && !shouldMirrorIssues && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Label mirroring check: mirrorLabels=${config.giteaConfig?.mirrorLabels}, shouldMirrorIssues=${shouldMirrorIssues}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorLabels=${shouldMirrorLabels}`); + console.log(`[Metadata] Label mirroring check: mirrorLabels=${config.giteaConfig?.mirrorLabels}, shouldMirrorIssues=${shouldMirrorIssues}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorLabels=${shouldMirrorLabels}`); if (shouldMirrorLabels) { try { @@ -553,11 +553,11 @@ export const mirrorGithubRepoToGitea = async ({ } // Mirror milestones if enabled - // Skip milestones for starred repos if skipStarredIssues is enabled + // Skip milestones for starred repos if starredCodeOnly is enabled const shouldMirrorMilestones = config.giteaConfig?.mirrorMilestones && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Milestone mirroring check: mirrorMilestones=${config.giteaConfig?.mirrorMilestones}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorMilestones=${shouldMirrorMilestones}`); + console.log(`[Metadata] Milestone mirroring check: mirrorMilestones=${config.giteaConfig?.mirrorMilestones}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorMilestones=${shouldMirrorMilestones}`); if (shouldMirrorMilestones) { try { @@ -848,9 +848,9 @@ export async function mirrorGitHubRepoToGiteaOrg({ // Prepare migration payload // For private repos, use separate auth fields instead of embedding credentials in URL // This is required for Forgejo 12+ which rejects URLs with embedded credentials - // Skip wiki for starred repos if skipStarredIssues is enabled + // Skip wiki for starred repos if starredCodeOnly is enabled const shouldMirrorWiki = config.giteaConfig?.wiki && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); const migratePayload: any = { clone_addr: cloneAddress, @@ -884,11 +884,11 @@ export async function mirrorGitHubRepoToGiteaOrg({ ); //mirror releases - // Skip releases for starred repos if skipStarredIssues is enabled + // Skip releases for starred repos if starredCodeOnly is enabled const shouldMirrorReleases = config.giteaConfig?.mirrorReleases && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Release mirroring check: mirrorReleases=${config.giteaConfig?.mirrorReleases}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorReleases=${shouldMirrorReleases}`); + console.log(`[Metadata] Release mirroring check: mirrorReleases=${config.giteaConfig?.mirrorReleases}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorReleases=${shouldMirrorReleases}`); if (shouldMirrorReleases) { try { @@ -907,11 +907,11 @@ export async function mirrorGitHubRepoToGiteaOrg({ } // Clone issues - // Skip issues for starred repos if skipStarredIssues is enabled + // Skip issues for starred repos if starredCodeOnly is enabled const shouldMirrorIssues = config.giteaConfig?.mirrorIssues && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Issue mirroring check: mirrorIssues=${config.giteaConfig?.mirrorIssues}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorIssues=${shouldMirrorIssues}`); + console.log(`[Metadata] Issue mirroring check: mirrorIssues=${config.giteaConfig?.mirrorIssues}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorIssues=${shouldMirrorIssues}`); if (shouldMirrorIssues) { try { @@ -930,11 +930,11 @@ export async function mirrorGitHubRepoToGiteaOrg({ } // Mirror pull requests if enabled - // Skip pull requests for starred repos if skipStarredIssues is enabled + // Skip pull requests for starred repos if starredCodeOnly is enabled const shouldMirrorPullRequests = config.giteaConfig?.mirrorPullRequests && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Pull request mirroring check: mirrorPullRequests=${config.giteaConfig?.mirrorPullRequests}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorPullRequests=${shouldMirrorPullRequests}`); + console.log(`[Metadata] Pull request mirroring check: mirrorPullRequests=${config.giteaConfig?.mirrorPullRequests}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorPullRequests=${shouldMirrorPullRequests}`); if (shouldMirrorPullRequests) { try { @@ -953,11 +953,11 @@ export async function mirrorGitHubRepoToGiteaOrg({ } // Mirror labels if enabled (and not already done via issues) - // Skip labels for starred repos if skipStarredIssues is enabled + // Skip labels for starred repos if starredCodeOnly is enabled const shouldMirrorLabels = config.giteaConfig?.mirrorLabels && !shouldMirrorIssues && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Label mirroring check: mirrorLabels=${config.giteaConfig?.mirrorLabels}, shouldMirrorIssues=${shouldMirrorIssues}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorLabels=${shouldMirrorLabels}`); + console.log(`[Metadata] Label mirroring check: mirrorLabels=${config.giteaConfig?.mirrorLabels}, shouldMirrorIssues=${shouldMirrorIssues}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorLabels=${shouldMirrorLabels}`); if (shouldMirrorLabels) { try { @@ -976,11 +976,11 @@ export async function mirrorGitHubRepoToGiteaOrg({ } // Mirror milestones if enabled - // Skip milestones for starred repos if skipStarredIssues is enabled + // Skip milestones for starred repos if starredCodeOnly is enabled const shouldMirrorMilestones = config.giteaConfig?.mirrorMilestones && - !(repository.isStarred && config.githubConfig?.skipStarredIssues); + !(repository.isStarred && config.githubConfig?.starredCodeOnly); - console.log(`[Metadata] Milestone mirroring check: mirrorMilestones=${config.giteaConfig?.mirrorMilestones}, isStarred=${repository.isStarred}, skipStarredIssues=${config.githubConfig?.skipStarredIssues}, shouldMirrorMilestones=${shouldMirrorMilestones}`); + console.log(`[Metadata] Milestone mirroring check: mirrorMilestones=${config.giteaConfig?.mirrorMilestones}, isStarred=${repository.isStarred}, starredCodeOnly=${config.githubConfig?.starredCodeOnly}, shouldMirrorMilestones=${shouldMirrorMilestones}`); if (shouldMirrorMilestones) { try { diff --git a/src/lib/utils/config-mapper.ts b/src/lib/utils/config-mapper.ts index 9ae97cd..d85f947 100644 --- a/src/lib/utils/config-mapper.ts +++ b/src/lib/utils/config-mapper.ts @@ -54,7 +54,7 @@ export function mapUiToDbConfig( defaultOrg: giteaConfig.organization, // Advanced options - skipStarredIssues: advancedOptions.skipStarredIssues, + starredCodeOnly: advancedOptions.starredCodeOnly, }; // Map Gitea config to match database schema @@ -152,7 +152,7 @@ export function mapDbToUiConfig(dbConfig: any): { // Map advanced options const advancedOptions: AdvancedOptions = { skipForks: !(dbConfig.githubConfig?.includeForks ?? true), // Invert includeForks to get skipForks - skipStarredIssues: dbConfig.githubConfig?.skipStarredIssues || false, + starredCodeOnly: dbConfig.githubConfig?.starredCodeOnly || false, }; return { diff --git a/src/types/config.ts b/src/types/config.ts index 98bf15a..08f124f 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -55,7 +55,7 @@ export interface MirrorOptions { export interface AdvancedOptions { skipForks: boolean; - skipStarredIssues: boolean; + starredCodeOnly: boolean; } export interface SaveConfigApiRequest {