site: block Copilot bot、renovate bot、dependa bot (#55150)

* site: block Copilot bot

* update

* update

* update

* update
This commit is contained in:
lijianan
2025-09-26 08:13:57 +08:00
committed by GitHub
parent bd1aa0114e
commit 1d433d59d5
4 changed files with 40 additions and 19 deletions

View File

@@ -5,6 +5,7 @@ import unionBy from 'lodash/unionBy';
import simpleGit from 'simple-git';
const cwd = process.cwd();
const git = simpleGit(cwd);
const excludes = [
@@ -15,29 +16,28 @@ const excludes = [
'alipay.com',
'taobao.com',
'ant-design-bot',
'github-actions',
'copilot',
'renovate',
'renovate[bot]',
'dependabot',
'dependabot[bot]',
];
async function execute() {
const logResult = await git.log();
let all = logResult.all.filter(({ author_email: email }) => {
for (let i = 0; i < excludes.length; i++) {
const item = excludes[i];
if (email.includes(item)) {
return false;
}
}
return true;
const filtered = logResult.all.filter(({ author_name, author_email }) => {
const name = author_name.toLowerCase();
const email = author_email.toLowerCase();
return !excludes.some((item) => email.includes(item) || name.includes(item));
});
all = sortBy(unionBy(all, 'author_email'), 'author_name');
const all = sortBy(unionBy(filtered, 'author_email'), 'author_name');
fs.writeFileSync(
path.join(cwd, 'contributors.json'),
JSON.stringify(
Array.from(new Set<string>(all.map((authorItem) => authorItem.author_name))),
null,
2,
),
JSON.stringify(Array.from(new Set(all.map((authorItem) => authorItem.author_name))), null, 2),
);
}