Merge pull request #1422 from Dokploy/1418-fetching-gitlab-repositories-0-found

fix(gitlab): update repository filtering and connection testing
This commit is contained in:
Mauricio Siu 2025-03-06 22:17:34 -06:00 committed by GitHub
commit f544efed35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -266,7 +266,7 @@ export const getGitlabRepositories = async (gitlabId?: string) => {
if (groupName) {
return full_path.toLowerCase().includes(groupName) && kind === "group";
}
return kind === "member";
return kind === "user";
});
const mappedRepositories = filteredRepos.map((repo: any) => {
return {
@ -409,6 +409,8 @@ export const testGitlabConnection = async (
const gitlabProvider = await findGitlabById(gitlabId);
console.log(gitlabProvider);
const response = await fetch(
`${gitlabProvider.gitlabUrl}/api/v4/projects?membership=true&owned=true&page=${0}&per_page=${100}`,
{
@ -427,13 +429,15 @@ export const testGitlabConnection = async (
const repositories = await response.json();
console.log(repositories);
const filteredRepos = repositories.filter((repo: any) => {
const { full_path, kind } = repo.namespace;
if (groupName) {
return full_path.toLowerCase().includes(groupName) && kind === "group";
}
return kind === "member";
return kind === "user";
});
return filteredRepos.length;