Skip to content

Commit 7cc4aa8

Browse files
committed
Fix for mirroring issues for starred repositories
1 parent ae41c4e commit 7cc4aa8

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/lib/gitea.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ export const mirrorGithubRepoToGitea = async ({
392392
config,
393393
octokit,
394394
repository,
395-
isRepoInOrg: false,
395+
giteaOwner: repoOwner,
396396
});
397397
}
398398

@@ -741,7 +741,7 @@ export async function mirrorGitHubRepoToGiteaOrg({
741741
config,
742742
octokit,
743743
repository,
744-
isRepoInOrg: true,
744+
giteaOwner: orgName,
745745
});
746746
}
747747

@@ -1183,12 +1183,12 @@ export const mirrorGitRepoIssuesToGitea = async ({
11831183
config,
11841184
octokit,
11851185
repository,
1186-
isRepoInOrg,
1186+
giteaOwner,
11871187
}: {
11881188
config: Partial<Config>;
11891189
octokit: Octokit;
11901190
repository: Repository;
1191-
isRepoInOrg: boolean;
1191+
giteaOwner: string;
11921192
}) => {
11931193
//things covered here are- issue, title, body, labels, comments and assignees
11941194
if (
@@ -1200,10 +1200,6 @@ export const mirrorGitRepoIssuesToGitea = async ({
12001200
throw new Error("Missing GitHub or Gitea configuration.");
12011201
}
12021202

1203-
const repoOrigin = isRepoInOrg
1204-
? repository.organization
1205-
: config.githubConfig.username;
1206-
12071203
const [owner, repo] = repository.fullName.split("/");
12081204

12091205
// Fetch GitHub issues
@@ -1232,7 +1228,7 @@ export const mirrorGitRepoIssuesToGitea = async ({
12321228

12331229
// Get existing labels from Gitea
12341230
const giteaLabelsRes = await httpGet(
1235-
`${config.giteaConfig.url}/api/v1/repos/${repoOrigin}/${repository.name}/labels`,
1231+
`${config.giteaConfig.url}/api/v1/repos/${giteaOwner}/${repository.name}/labels`,
12361232
{
12371233
Authorization: `token ${config.giteaConfig.token}`,
12381234
}
@@ -1264,7 +1260,7 @@ export const mirrorGitRepoIssuesToGitea = async ({
12641260
} else {
12651261
try {
12661262
const created = await httpPost(
1267-
`${config.giteaConfig!.url}/api/v1/repos/${repoOrigin}/${
1263+
`${config.giteaConfig!.url}/api/v1/repos/${giteaOwner}/${
12681264
repository.name
12691265
}/labels`,
12701266
{ name, color: "#ededed" }, // Default color
@@ -1301,7 +1297,7 @@ export const mirrorGitRepoIssuesToGitea = async ({
13011297

13021298
// Create the issue in Gitea
13031299
const createdIssue = await httpPost(
1304-
`${config.giteaConfig!.url}/api/v1/repos/${repoOrigin}/${
1300+
`${config.giteaConfig!.url}/api/v1/repos/${giteaOwner}/${
13051301
repository.name
13061302
}/issues`,
13071303
issuePayload,
@@ -1328,7 +1324,7 @@ export const mirrorGitRepoIssuesToGitea = async ({
13281324
comments,
13291325
async (comment) => {
13301326
await httpPost(
1331-
`${config.giteaConfig!.url}/api/v1/repos/${repoOrigin}/${
1327+
`${config.giteaConfig!.url}/api/v1/repos/${giteaOwner}/${
13321328
repository.name
13331329
}/issues/${createdIssue.data.number}/comments`,
13341330
{

0 commit comments

Comments
 (0)