feat(sync): add branch & tag listing support and improve sync mirroring and sync log routing
This commit is contained in:
@@ -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[]> {
|
||||
|
||||
Reference in New Issue
Block a user