Skip to content

Commit 251baeb

Browse files
committed
Fixed Private Repo Issues
1 parent e6a3151 commit 251baeb

File tree

4 files changed

+35
-34
lines changed

4 files changed

+35
-34
lines changed

src/components/organizations/OrganizationsList.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ export function OrganizationList({
281281
<div className="flex items-center gap-3">
282282
<Skeleton className="h-4 w-20" />
283283
<Skeleton className="h-4 w-20" />
284+
<Skeleton className="h-4 w-20" />
284285
</div>
285286
) : (
286287
<div className="flex items-center gap-3">
@@ -300,6 +301,14 @@ export function OrganizationList({
300301
</span>
301302
</div>
302303
)}
304+
{org.forkRepositoryCount !== undefined && org.forkRepositoryCount > 0 && (
305+
<div className="flex items-center gap-1.5">
306+
<div className="h-2.5 w-2.5 rounded-full bg-blue-500" />
307+
<span className="text-muted-foreground">
308+
{org.forkRepositoryCount} {org.forkRepositoryCount === 1 ? "fork" : "forks"}
309+
</span>
310+
</div>
311+
)}
303312
</div>
304313
)}
305314
</div>

src/lib/github.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,11 @@ export async function getGithubRepositories({
5252
{ per_page: 100 }
5353
);
5454

55-
const includePrivate = config.githubConfig?.privateRepositories ?? false;
5655
const skipForks = config.githubConfig?.skipForks ?? false;
5756

5857
const filteredRepos = repos.filter((repo) => {
59-
const isPrivateAllowed = includePrivate || !repo.private;
6058
const isForkAllowed = !skipForks || !repo.fork;
61-
return isPrivateAllowed && isForkAllowed;
59+
return isForkAllowed;
6260
});
6361

6462
return filteredRepos.map((repo) => ({

src/pages/api/github/organizations.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,27 @@ export const GET: APIRoute = async ({ request }) => {
9191
.from(repositories)
9292
.where(and(...publicConditions));
9393

94-
// Get private count (only if private repos are enabled in config)
95-
const [privateCount] = githubConfig.privateRepositories ? await db
94+
// Get private count (always show actual count regardless of config)
95+
const [privateCount] = await db
9696
.select({ count: count() })
9797
.from(repositories)
9898
.where(
9999
and(
100100
...baseConditions,
101-
eq(repositories.isPrivate, true),
102-
...(githubConfig.skipForks ? [eq(repositories.isForked, false)] : [])
101+
eq(repositories.isPrivate, true)
103102
)
104-
) : [{ count: 0 }];
103+
);
105104

106-
// Get fork count (only if forks are enabled in config)
107-
const [forkCount] = !githubConfig.skipForks ? await db
105+
// Get fork count (always show actual count regardless of config)
106+
const [forkCount] = await db
108107
.select({ count: count() })
109108
.from(repositories)
110109
.where(
111110
and(
112111
...baseConditions,
113-
eq(repositories.isForked, true),
114-
...(!githubConfig.privateRepositories ? [eq(repositories.isPrivate, false)] : [])
112+
eq(repositories.isForked, true)
115113
)
116-
) : [{ count: 0 }];
114+
);
117115

118116
return {
119117
...org,

src/pages/api/sync/organization.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -78,36 +78,32 @@ export const POST: APIRoute = async ({ request }) => {
7878
// Fetch repos based on config settings
7979
const allRepos = [];
8080

81-
// Always fetch public repos
81+
// Fetch all repos (public, private, and member) to show in UI
8282
const publicRepos = await octokit.paginate(octokit.repos.listForOrg, {
8383
org,
8484
type: "public",
8585
per_page: 100,
8686
});
8787
allRepos.push(...publicRepos);
8888

89-
// Fetch private repos if enabled in config
90-
if (decryptedConfig.githubConfig?.includePrivate) {
91-
const privateRepos = await octokit.paginate(octokit.repos.listForOrg, {
92-
org,
93-
type: "private",
94-
per_page: 100,
95-
});
96-
allRepos.push(...privateRepos);
97-
}
89+
// Always fetch private repos to show them in the UI
90+
const privateRepos = await octokit.paginate(octokit.repos.listForOrg, {
91+
org,
92+
type: "private",
93+
per_page: 100,
94+
});
95+
allRepos.push(...privateRepos);
9896

9997
// Also fetch member repos (includes private repos the user has access to)
100-
if (decryptedConfig.githubConfig?.includePrivate) {
101-
const memberRepos = await octokit.paginate(octokit.repos.listForOrg, {
102-
org,
103-
type: "member",
104-
per_page: 100,
105-
});
106-
// Filter out duplicates
107-
const existingIds = new Set(allRepos.map(r => r.id));
108-
const uniqueMemberRepos = memberRepos.filter(r => !existingIds.has(r.id));
109-
allRepos.push(...uniqueMemberRepos);
110-
}
98+
const memberRepos = await octokit.paginate(octokit.repos.listForOrg, {
99+
org,
100+
type: "member",
101+
per_page: 100,
102+
});
103+
// Filter out duplicates
104+
const existingIds = new Set(allRepos.map(r => r.id));
105+
const uniqueMemberRepos = memberRepos.filter(r => !existingIds.has(r.id));
106+
allRepos.push(...uniqueMemberRepos);
111107

112108
// Insert repositories
113109
const repoRecords = allRepos.map((repo) => ({

0 commit comments

Comments
 (0)