This commit is contained in:
xiongxiao
2026-03-18 01:34:14 +08:00
committed by cnb
parent 28a5f9a7f1
commit 5bf3a7a063

View File

@@ -24,14 +24,45 @@ app.route({
const updatedAt = dayjs(item.updated_at);
return updatedAt.isAfter(twelveHoursAgo);
});
const repositories = todayList.map(item => ({
const _todayList = todayList.map(item => ({
path: item.path,
name: item.name,
web_url: item.web_url,
description: item.description,
topics: item.topics ? item.topics.split(',').filter(Boolean) : [],
})).filter(item => item.topics.includes('gitea'));
}))
const repositories = _todayList.filter(item => item.topics.includes('gitea'));
app.run({ path: 'cnb', key: 'report', payload: { repoList: repositories } });
ctx.body = {
list: repositories
}
}).addTo(app)
app.route({
path: 'cnb',
key: 'report',
description: '上报仓库信息',
metadata: {
args: {
repoList: z.array(repoSchema).describe('仓库列表')
}
}
}).define(async (ctx) => {
const { repoList } = ctx.args;
// 处理上报的仓库信息
if (Array.isArray(repoList)) {
let infoTable = '| 仓库路径 | 仓库名称 | 仓库链接 | 仓库描述 | 仓库标签 |\n';
infoTable += '| --- | --- | --- | --- | --- |\n';
repoList.forEach(repo => {
const topics = repo.topics.join(', ');
infoTable += `| ${repo.path} | ${repo.name} | [链接](${repo.web_url}) | ${repo.description} | ${topics} |\n`;
});
console.log('上报的仓库信息表格:\n', infoTable);
cnb.issue.createIssue('kevisual/kevisual', {
title: `仓库信息上报 - ${dayjs().format('YYYY-MM-DD HH:mm:ss')}`,
content: `以下是上报的仓库信息:\n\n${infoTable}`,
// @ts-ignore
labels: ['report']
})
}
}).addTo(app)