mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-07 20:16:46 +03:00
Fix for mirroring issues for starred repositories
This commit is contained in:
@@ -392,7 +392,7 @@ export const mirrorGithubRepoToGitea = async ({
|
|||||||
config,
|
config,
|
||||||
octokit,
|
octokit,
|
||||||
repository,
|
repository,
|
||||||
isRepoInOrg: false,
|
giteaOwner: repoOwner,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,7 +741,7 @@ export async function mirrorGitHubRepoToGiteaOrg({
|
|||||||
config,
|
config,
|
||||||
octokit,
|
octokit,
|
||||||
repository,
|
repository,
|
||||||
isRepoInOrg: true,
|
giteaOwner: orgName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1183,12 +1183,12 @@ export const mirrorGitRepoIssuesToGitea = async ({
|
|||||||
config,
|
config,
|
||||||
octokit,
|
octokit,
|
||||||
repository,
|
repository,
|
||||||
isRepoInOrg,
|
giteaOwner,
|
||||||
}: {
|
}: {
|
||||||
config: Partial<Config>;
|
config: Partial<Config>;
|
||||||
octokit: Octokit;
|
octokit: Octokit;
|
||||||
repository: Repository;
|
repository: Repository;
|
||||||
isRepoInOrg: boolean;
|
giteaOwner: string;
|
||||||
}) => {
|
}) => {
|
||||||
//things covered here are- issue, title, body, labels, comments and assignees
|
//things covered here are- issue, title, body, labels, comments and assignees
|
||||||
if (
|
if (
|
||||||
@@ -1200,10 +1200,6 @@ export const mirrorGitRepoIssuesToGitea = async ({
|
|||||||
throw new Error("Missing GitHub or Gitea configuration.");
|
throw new Error("Missing GitHub or Gitea configuration.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const repoOrigin = isRepoInOrg
|
|
||||||
? repository.organization
|
|
||||||
: config.githubConfig.username;
|
|
||||||
|
|
||||||
const [owner, repo] = repository.fullName.split("/");
|
const [owner, repo] = repository.fullName.split("/");
|
||||||
|
|
||||||
// Fetch GitHub issues
|
// Fetch GitHub issues
|
||||||
@@ -1232,7 +1228,7 @@ export const mirrorGitRepoIssuesToGitea = async ({
|
|||||||
|
|
||||||
// Get existing labels from Gitea
|
// Get existing labels from Gitea
|
||||||
const giteaLabelsRes = await httpGet(
|
const giteaLabelsRes = await httpGet(
|
||||||
`${config.giteaConfig.url}/api/v1/repos/${repoOrigin}/${repository.name}/labels`,
|
`${config.giteaConfig.url}/api/v1/repos/${giteaOwner}/${repository.name}/labels`,
|
||||||
{
|
{
|
||||||
Authorization: `token ${config.giteaConfig.token}`,
|
Authorization: `token ${config.giteaConfig.token}`,
|
||||||
}
|
}
|
||||||
@@ -1264,7 +1260,7 @@ export const mirrorGitRepoIssuesToGitea = async ({
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
const created = await httpPost(
|
const created = await httpPost(
|
||||||
`${config.giteaConfig!.url}/api/v1/repos/${repoOrigin}/${
|
`${config.giteaConfig!.url}/api/v1/repos/${giteaOwner}/${
|
||||||
repository.name
|
repository.name
|
||||||
}/labels`,
|
}/labels`,
|
||||||
{ name, color: "#ededed" }, // Default color
|
{ name, color: "#ededed" }, // Default color
|
||||||
@@ -1301,7 +1297,7 @@ export const mirrorGitRepoIssuesToGitea = async ({
|
|||||||
|
|
||||||
// Create the issue in Gitea
|
// Create the issue in Gitea
|
||||||
const createdIssue = await httpPost(
|
const createdIssue = await httpPost(
|
||||||
`${config.giteaConfig!.url}/api/v1/repos/${repoOrigin}/${
|
`${config.giteaConfig!.url}/api/v1/repos/${giteaOwner}/${
|
||||||
repository.name
|
repository.name
|
||||||
}/issues`,
|
}/issues`,
|
||||||
issuePayload,
|
issuePayload,
|
||||||
@@ -1328,7 +1324,7 @@ export const mirrorGitRepoIssuesToGitea = async ({
|
|||||||
comments,
|
comments,
|
||||||
async (comment) => {
|
async (comment) => {
|
||||||
await httpPost(
|
await httpPost(
|
||||||
`${config.giteaConfig!.url}/api/v1/repos/${repoOrigin}/${
|
`${config.giteaConfig!.url}/api/v1/repos/${giteaOwner}/${
|
||||||
repository.name
|
repository.name
|
||||||
}/issues/${createdIssue.data.number}/comments`,
|
}/issues/${createdIssue.data.number}/comments`,
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user