paginate app operations and refine runtime settings layout
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -175,6 +175,8 @@ export class GiteaService {
|
||||
await this.createDefaultBranches(repo.owner.login, repo.name, repo.default_branch, body);
|
||||
}
|
||||
|
||||
await this.setDefaultBranch(repo.owner.login, repo.name, 'develop');
|
||||
|
||||
if (body.createReleaseBranch !== false) {
|
||||
await this.protectReleaseBranch(repo.owner.login, repo.name);
|
||||
}
|
||||
@@ -194,6 +196,8 @@ export class GiteaService {
|
||||
await this.createDefaultBranches(org, repo.name, repo.default_branch, body);
|
||||
}
|
||||
|
||||
await this.setDefaultBranch(org, repo.name, 'develop');
|
||||
|
||||
if (body.createReleaseBranch !== false) {
|
||||
await this.protectReleaseBranch(org, repo.name);
|
||||
}
|
||||
@@ -201,6 +205,22 @@ export class GiteaService {
|
||||
return { repo: mapRepo(repo), branches: await this.listBranches(org, repo.name) };
|
||||
}
|
||||
|
||||
private async setDefaultBranch(owner: string, repo: string, branch: string) {
|
||||
const branches = await this.listBranches(owner, repo);
|
||||
const hasBranch = Array.isArray(branches.branches) && branches.branches.some((item) => {
|
||||
return typeof item === 'object' && item && 'name' in item && item.name === branch;
|
||||
});
|
||||
|
||||
if (!hasBranch) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.request(`/api/v1/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify({ default_branch: branch }),
|
||||
});
|
||||
}
|
||||
|
||||
async createUserSshKey(username: string, body: { title: string; key: string }) {
|
||||
this.assertToken();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user