[ci] Add stale issue pr close bot

This commit is contained in:
Xing Yahao
2022-02-27 15:51:37 +09:00
parent 659d73d0e7
commit 23f01d6ddd
3 changed files with 45 additions and 187 deletions

View File

@@ -29,7 +29,7 @@ const categories = {
},
condiment: {
title: '酱料和其它材料',
template:'',
template: '',
},
dessert: {
title: '甜品',
@@ -69,7 +69,7 @@ let README_TEMPLATE = `# 程序员做饭指南
async function main() {
try {
let BEFORE = MAIN = AFTER = '';
let BEFORE = (MAIN = AFTER = '');
const markdownObj = await getAllMarkdown('.');
for (const markdown of markdownObj) {
if (markdown.path.includes('tips/advanced')) {
@@ -94,9 +94,12 @@ async function main() {
MAIN += categoryTemplate(category.title, category.template);
}
await writeFile('./README.md', README_TEMPLATE.replace('{{before}}', BEFORE)
.replace('{{main}}', MAIN)
.replace('{{after}}', AFTER));
await writeFile(
'./README.md',
README_TEMPLATE.replace('{{before}}', BEFORE)
.replace('{{main}}', MAIN)
.replace('{{after}}', AFTER),
);
} catch (error) {
console.error(error);
}
@@ -105,6 +108,15 @@ async function main() {
async function getAllMarkdown(path) {
const paths = [];
const files = await readdir(path);
// chinese alphabetic order
files.sort((a, b) => a.localeCompare(b, 'zh-CN'));
// mtime order
// files.sort(async (a, b) => {
// const aStat = await stat(`${path}/${a}`);
// const bStat = await stat(`${path}/${b}`);
// return aStat.mtime - bStat.mtime;
// });
for (const file of files) {
const filePath = `${path}/${file}`;
if (ignorePaths.includes(file)) continue;

28
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- "Type: Bug"
# Label to use when marking an issue as stale
staleLabel: "Resolution: Stale"
issues:
# Comment to post when marking an issue as stale.
markComment: >
This issue has been automatically marked as stale.
**If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open.
We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
# Comment to post when closing a stale issue.
closeComment: >
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
pulls:
# Comment to post when marking a pull request as stale.
markComment: >
This pull request has been automatically marked as stale.
**If this pull request is still relevant, please leave any comment** (for example, "bump"), and we'll keep it open.
We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.
# Comment to post when closing a stale pull request.
closeComment: >
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!