mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-08 20:46:44 +03:00
fix: mirror to one org issue
This commit is contained in:
@@ -19,7 +19,11 @@ function TooltipProvider({
|
|||||||
function Tooltip({
|
function Tooltip({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
||||||
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
return (
|
||||||
|
<TooltipProvider>
|
||||||
|
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
||||||
|
</TooltipProvider>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function TooltipTrigger({
|
function TooltipTrigger({
|
||||||
@@ -40,7 +44,7 @@ function TooltipContent({
|
|||||||
data-slot="tooltip-content"
|
data-slot="tooltip-content"
|
||||||
sideOffset={sideOffset}
|
sideOffset={sideOffset}
|
||||||
className={cn(
|
className={cn(
|
||||||
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-[var(--radix-tooltip-content-transform-origin)] rounded-md px-3 py-1.5 text-xs text-balance",
|
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
@@ -1,17 +1,4 @@
|
|||||||
import { defineCollection, z } from 'astro:content';
|
import { defineCollection, z } from 'astro:content';
|
||||||
|
|
||||||
// Define a schema for the documentation collection
|
// Export empty collections since docs have been moved
|
||||||
const docsCollection = defineCollection({
|
export const collections = {};
|
||||||
type: 'content',
|
|
||||||
schema: z.object({
|
|
||||||
title: z.string(),
|
|
||||||
description: z.string(),
|
|
||||||
order: z.number().optional(),
|
|
||||||
updatedDate: z.date().optional(),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Export the collections
|
|
||||||
export const collections = {
|
|
||||||
'docs': docsCollection,
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -105,8 +105,17 @@ export const POST: APIRoute = async ({ request }) => {
|
|||||||
|
|
||||||
console.log(`Repository ${repo.name} will be mirrored to owner: ${owner}`);
|
console.log(`Repository ${repo.name} will be mirrored to owner: ${owner}`);
|
||||||
|
|
||||||
// Check if owner is different from the user (means it's going to an org)
|
// For single-org and starred repos strategies, or when mirroring to an org,
|
||||||
if (owner !== config.giteaConfig?.username) {
|
// always use the org mirroring function to ensure proper organization handling
|
||||||
|
const mirrorStrategy = config.giteaConfig?.mirrorStrategy ||
|
||||||
|
(config.githubConfig?.preserveOrgStructure ? "preserve" : "flat-user");
|
||||||
|
|
||||||
|
const shouldUseOrgMirror =
|
||||||
|
owner !== config.giteaConfig?.username || // Different owner means org
|
||||||
|
mirrorStrategy === "single-org" || // Single-org strategy always uses org
|
||||||
|
repoData.isStarred; // Starred repos always go to org
|
||||||
|
|
||||||
|
if (shouldUseOrgMirror) {
|
||||||
await mirrorGitHubOrgRepoToGiteaOrg({
|
await mirrorGitHubOrgRepoToGiteaOrg({
|
||||||
config,
|
config,
|
||||||
octokit,
|
octokit,
|
||||||
|
|||||||
@@ -137,8 +137,17 @@ export const POST: APIRoute = async ({ request }) => {
|
|||||||
|
|
||||||
console.log(`Importing repo: ${repo.name} to owner: ${owner}`);
|
console.log(`Importing repo: ${repo.name} to owner: ${owner}`);
|
||||||
|
|
||||||
// Check if owner is different from the user (means it's going to an org)
|
// For single-org and starred repos strategies, or when mirroring to an org,
|
||||||
if (owner !== config.giteaConfig?.username) {
|
// always use the org mirroring function to ensure proper organization handling
|
||||||
|
const mirrorStrategy = config.giteaConfig?.mirrorStrategy ||
|
||||||
|
(config.githubConfig?.preserveOrgStructure ? "preserve" : "flat-user");
|
||||||
|
|
||||||
|
const shouldUseOrgMirror =
|
||||||
|
owner !== config.giteaConfig?.username || // Different owner means org
|
||||||
|
mirrorStrategy === "single-org" || // Single-org strategy always uses org
|
||||||
|
repoData.isStarred; // Starred repos always go to org
|
||||||
|
|
||||||
|
if (shouldUseOrgMirror) {
|
||||||
await mirrorGitHubOrgRepoToGiteaOrg({
|
await mirrorGitHubOrgRepoToGiteaOrg({
|
||||||
config,
|
config,
|
||||||
octokit,
|
octokit,
|
||||||
|
|||||||
Reference in New Issue
Block a user