diff --git a/src/routes/cnb.ts b/src/routes/cnb.ts index cc78856..5957bd3 100644 --- a/src/routes/cnb.ts +++ b/src/routes/cnb.ts @@ -8,7 +8,8 @@ const repoSchema = z.object({ web_url: z.string().describe('仓库链接'), description: z.string().describe('仓库描述'), topics: z.array(z.string()).describe('仓库标签'), - giteaUrl: z.string().optional().describe('gitea仓库链接') + giteaUrl: z.string().optional().describe('gitea仓库链接'), + updatedAt: z.string().describe('仓库更新时间'), }).describe('仓库信息'); export type Repo = z.infer; @@ -30,6 +31,7 @@ app.route({ web_url: item.web_url, description: item.description, topics: item.topics ? item.topics.split(',').filter(Boolean) : [], + updatedAt: dayjs(item.updated_at).format('YYYY-MM-DD HH:mm:ss'), })) const repositories = _todayList.filter(item => item.topics.includes('gitea')); if (_todayList.length > 5) { @@ -54,11 +56,11 @@ app.route({ // 处理上报的仓库信息 await closeOldReports(); if (Array.isArray(repoList)) { - let infoTable = '| 仓库路径 | 仓库链接 | 仓库描述 | 仓库标签 |\n'; - infoTable += '| --- | --- | --- | --- |\n'; + let infoTable = '| 仓库路径 | 仓库链接 | 仓库描述 | 仓库标签 | 更新时间 |\n'; + infoTable += '| --- | --- | --- | --- | --- |\n'; repoList.forEach(repo => { const topics = repo.topics.join(', '); - infoTable += `| ${repo.path} | [链接](${repo.web_url}) | ${repo.description} | ${topics} |\n`; + infoTable += `| ${repo.path} | [链接](${repo.web_url}) | ${repo.description} | ${topics} | ${repo.updatedAt} |\n`; }); console.log('上报的仓库信息表格:\n', infoTable); cnb.issue.createIssue('kevisual/kevisual', { diff --git a/src/routes/sync.ts b/src/routes/sync.ts index a303ac6..1550fa2 100644 --- a/src/routes/sync.ts +++ b/src/routes/sync.ts @@ -20,7 +20,8 @@ app.route({ const giteaRepo = await gitea.repo.getRepo(owner, repo); const giteaUsername = 'oauth2'; const giteaPassword = useKey('GITEA_TOKEN'); - item.giteaUrl = `https://${giteaUsername}:${giteaPassword}@git.xiongxiao.me/${owner}/${repo}.git`; + const giteaHost = useKey('GITEA_HOST') || 'git.xiongxiao.me'; + item.giteaUrl = `https://${giteaUsername}:${giteaPassword}@${giteaHost}/${owner}/${repo}.git`; if (giteaRepo.code === 200) { // 已经存在了 } else {