update
This commit is contained in:
@@ -24,14 +24,45 @@ app.route({
|
|||||||
const updatedAt = dayjs(item.updated_at);
|
const updatedAt = dayjs(item.updated_at);
|
||||||
return updatedAt.isAfter(twelveHoursAgo);
|
return updatedAt.isAfter(twelveHoursAgo);
|
||||||
});
|
});
|
||||||
const repositories = todayList.map(item => ({
|
const _todayList = todayList.map(item => ({
|
||||||
path: item.path,
|
path: item.path,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
web_url: item.web_url,
|
web_url: item.web_url,
|
||||||
description: item.description,
|
description: item.description,
|
||||||
topics: item.topics ? item.topics.split(',').filter(Boolean) : [],
|
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 = {
|
ctx.body = {
|
||||||
list: repositories
|
list: repositories
|
||||||
}
|
}
|
||||||
}).addTo(app)
|
}).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)
|
||||||
Reference in New Issue
Block a user