feat(sync): add branch & tag listing support and improve sync mirroring and sync log routing

This commit is contained in:
2026-03-02 10:37:07 +00:00
parent 75d35405dc
commit 56403224c0
16 changed files with 411 additions and 57 deletions

View File

@@ -85,6 +85,42 @@ export class GitLabProvider extends BaseProvider {
return allGroups.map((g) => this.mapGroup(g));
}
// --- Branches / Tags ---
async getBranches(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.IBranch[]> {
if (opts?.page) {
const branches = await this.client.getRepoBranches(projectFullPath, opts);
return branches.map((b) => ({ name: b.name, commitSha: b.commit.id }));
}
const all: interfaces.data.IBranch[] = [];
const perPage = opts?.perPage || 50;
let page = 1;
while (true) {
const branches = await this.client.getRepoBranches(projectFullPath, { ...opts, page, perPage });
all.push(...branches.map((b) => ({ name: b.name, commitSha: b.commit.id })));
if (branches.length < perPage) break;
page++;
}
return all;
}
async getTags(projectFullPath: string, opts?: IListOptions): Promise<interfaces.data.ITag[]> {
if (opts?.page) {
const tags = await this.client.getRepoTags(projectFullPath, opts);
return tags.map((t) => ({ name: t.name, commitSha: t.commit.id }));
}
const all: interfaces.data.ITag[] = [];
const perPage = opts?.perPage || 50;
let page = 1;
while (true) {
const tags = await this.client.getRepoTags(projectFullPath, { ...opts, page, perPage });
all.push(...tags.map((t) => ({ name: t.name, commitSha: t.commit.id })));
if (tags.length < perPage) break;
page++;
}
return all;
}
// --- Project Secrets (CI/CD Variables) ---
async getProjectSecrets(projectId: string): Promise<interfaces.data.ISecret[]> {