chore: update auto label

This commit is contained in:
Tony
2025-06-05 21:07:25 +08:00
parent e10c3a51ee
commit ef22a71dd6
7 changed files with 21 additions and 16 deletions
@@ -4,11 +4,11 @@ import remarkParse from 'remark-parse';
// @TODO maybe we could use label or some other better ways to distinguish bug/feature issues
const matchTitle = ['路由地址', 'Routes'];
const maintainerURL = 'https://raw.githubusercontent.com/DIYgod/RSSHub/gh-pages/build/maintainers.json';
const successTag = 'Bug Ping: Pinged';
const parseFailTag = 'Bug Ping: Parsing Failed';
const failTag = 'Bug Ping: Not Found';
const deprecatedRoute = 'Route: deprecated';
const route = 'Route';
const successTag = 'bug ping: pinged';
const parseFailTag = 'bug ping: parsing failed';
const failTag = 'bug ping: not found';
const deprecatedRoute = 'route: deprecated';
const route = 'route';
// DnD (do-not-disturb) usernames, add yours here to avoid being notified
const dndUsernames = new Set([]);
+4 -4
View File
@@ -1,5 +1,5 @@
const noFound = 'Auto: Route No Found';
const testFailed = 'Auto: Route Test Failed';
const noFound = 'auto: route no found';
const testFailed = 'auto: DO NOT merge';
const allowedUser = new Set(['dependabot[bot]', 'pull[bot]']); // dependabot and downstream PR requested by pull[bot]
export default async function identify({ github, context, core }, body, number, sender) {
@@ -89,7 +89,7 @@ export default async function identify({ github, context, core }, body, number,
if (allowedUser.has(sender)) {
core.info('PR created by a allowed user, passing');
await removeLabel();
await addLabels(['Auto: allowed']);
await addLabels(['auto: ready to merge']);
return;
} else {
core.debug('PR created by ' + sender);
@@ -102,7 +102,7 @@ export default async function identify({ github, context, core }, body, number,
if (routes.length && routes[0] === 'NOROUTE') {
core.info('PR stated no route, passing');
await removeLabel();
await addLabels(['Auto: Route Test Skipped']);
await addLabels(['auto: route test bypassed']);
return;
} else if (routes.length) {
+6 -1
View File
@@ -11,6 +11,8 @@ export default async function test({ github, context, core }, baseUrl, routes, n
});
let commentList = [];
let successCount = 0;
let failCount = 0;
let comment = `Successfully [generated](${process.env.GITHUB_SERVER_URL}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) as following:\n`;
for await (const lks of links) {
@@ -23,8 +25,10 @@ export default async function test({ github, context, core }, baseUrl, routes, n
const body = await res.text();
if (res.ok) {
success = true;
successCount++;
detail = jsBeautify.html(body.replaceAll(/\s+(\n|$)/g, '\n'), { indent_size: 2 });
} else {
failCount++;
detail = `HTTPError: Response code ${res.status} (${res.statusText})`;
const errInfoList = body && body.match(/(?<=<p class="message">)(.+?)(?=<\/p>)/gs);
if (errInfoList) {
@@ -67,12 +71,13 @@ ${detail.slice(0, 65300 - routeFeedback.length)}
}
if (process.env.PULL_REQUEST) {
const resultLabel = failCount === links.length || successCount <= failCount ? 'auto: not ready to review' : 'auto: ready to review';
await github.rest.issues
.addLabels({
issue_number: number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Auto: Route Test Complete'],
labels: [resultLabel],
})
.catch((error) => {
core.warning(error);