确保在同步仓库数据时,检查并创建缺失的组织

This commit is contained in:
abearxiong committed 2026-06-01 23:58:50 +08:00
1 parent b0df0c14b1
commit 8e5bef409d
2 files changed
+9 -1

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@
script: |
bun i
bun run src/cli.ts repo sync
timeout: 120s
timeout: 180s
main:
"crontab: 0 11,23 * * *": !reference [.crontab-job]
+8
View File
@@ -28,6 +28,14 @@ app.route({
if (giteaRepo.code === 200) {
// 已经存在了
} else {
// 确保 org 存在,不存在则创建
const orgRes = await gitea.org.getOrg(org);
if (orgRes.code !== 200) {
await gitea.org.createOrg({
username: org,
description: `Auto created org for ${org}`,
}).catch(err => console.error(`创建组织 ${org} 失败,可能不是管理员`, err));
}
await gitea.repo.createRepo({
name: org + '/' + repo,
description: item.description,