mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
site: block Copilot bot、renovate bot、dependa bot (#55150)
* site: block Copilot bot * update * update * update * update
This commit is contained in:
@@ -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),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user