mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-02 18:18:06 +08:00
chore(workflow): close issue if not found, add v1/v2 route tag
This commit is contained in:
@@ -8,6 +8,8 @@ const maintainerURL = 'https://raw.githubusercontent.com/DIYgod/RSSHub/gh-pages/
|
|||||||
const successTag = 'Bug Ping: Pinged';
|
const successTag = 'Bug Ping: Pinged';
|
||||||
const parseFailure = 'Bug Ping: Parse Failure';
|
const parseFailure = 'Bug Ping: Parse Failure';
|
||||||
const failTag = 'Bug Ping: Not Found';
|
const failTag = 'Bug Ping: Not Found';
|
||||||
|
const v1route = 'Route: v1';
|
||||||
|
const v2route = 'Route: v2';
|
||||||
const ignoreUsername = new Set([]); // Wrap user who don't want to be pinged.
|
const ignoreUsername = new Set([]); // Wrap user who don't want to be pinged.
|
||||||
|
|
||||||
async function parseBodyRoutes(body, core) {
|
async function parseBodyRoutes(body, core) {
|
||||||
@@ -82,6 +84,8 @@ module.exports = async ({ github, context, core }) => {
|
|||||||
const maintainers = await getMaintainersByRoutes(routes, core);
|
const maintainers = await getMaintainersByRoutes(routes, core);
|
||||||
|
|
||||||
let successCount = 0;
|
let successCount = 0;
|
||||||
|
let emptyCount = 0;
|
||||||
|
let failedCount = 0;
|
||||||
let comments = '##### Trying to find maintainers: \n\n';
|
let comments = '##### Trying to find maintainers: \n\n';
|
||||||
|
|
||||||
for (let i = 0; i < routes.length; i++) {
|
for (let i = 0; i < routes.length; i++) {
|
||||||
@@ -89,12 +93,13 @@ module.exports = async ({ github, context, core }) => {
|
|||||||
const main = maintainers[i];
|
const main = maintainers[i];
|
||||||
if (main === undefined) {
|
if (main === undefined) {
|
||||||
comments += `- \`${route}\`: **Not found in list**\n`;
|
comments += `- \`${route}\`: **Not found in list**\n`;
|
||||||
|
failedCount += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (main.length === 0) {
|
if (main.length === 0) {
|
||||||
comments += `- \`${route}\`: No maintainer listed, possibly v1 route or misconfigure\n`;
|
comments += `- \`${route}\`: No maintainer listed, possibly v1 route or misconfigure\n`;
|
||||||
successCount += 1;
|
emptyCount += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +117,32 @@ module.exports = async ({ github, context, core }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const labels = [`Count: ${successCount}/${routes.length}`];
|
||||||
|
|
||||||
|
if (failedCount > 0) {
|
||||||
|
labels.push(failTag);
|
||||||
|
} else {
|
||||||
|
labels.push(successTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (emptyCount > 0) {
|
||||||
|
labels.push(v1route);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (successCount > 0) {
|
||||||
|
labels.push(v2route);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write Affected Route Count
|
||||||
|
await github.rest.issues
|
||||||
|
.addLabels({
|
||||||
|
...issue_facts,
|
||||||
|
labels,
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
core.warning(e);
|
||||||
|
});
|
||||||
|
|
||||||
// Send out notification
|
// Send out notification
|
||||||
await github.rest.issues
|
await github.rest.issues
|
||||||
.createComment({
|
.createComment({
|
||||||
@@ -120,39 +151,23 @@ module.exports = async ({ github, context, core }) => {
|
|||||||
|
|
||||||
|
|
||||||
> Maintainers: if you do not want to be notified, add your name in scripts/test-issue/find-maintainer.js so your name will be wrapped when tagged.
|
> Maintainers: if you do not want to be notified, add your name in scripts/test-issue/find-maintainer.js so your name will be wrapped when tagged.
|
||||||
|
|
||||||
|
如果有任何路由无法匹配,Issue将会被自动关闭。如果Issue和路由无关,请使用\`NOROUTE\`关键词,或者留下评论。我们会重新审核
|
||||||
|
If route does not match any record, it will be closed automatically. Please use \`NOROUTE\` for any non-route related issue. Leave comment is this is a mistake.
|
||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
core.warning(e);
|
core.warning(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (successCount === routes.length) {
|
if (failedCount > 0) {
|
||||||
await github.rest.issues
|
await github.rest.issues
|
||||||
.addLabels({
|
.update({
|
||||||
...issue_facts,
|
...issue_facts,
|
||||||
labels: [successTag],
|
state: 'closed',
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
core.warning(e);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
await github.rest.issues
|
|
||||||
.addLabels({
|
|
||||||
...issue_facts,
|
|
||||||
labels: [failTag],
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
core.warning(e);
|
core.warning(e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write Affected Route Count
|
|
||||||
await github.rest.issues
|
|
||||||
.addLabels({
|
|
||||||
...issue_facts,
|
|
||||||
labels: [`Count: ${successCount}/${routes.length}`],
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
core.warning(e);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user