style: auto format

This commit is contained in:
GitHub Action
2021-01-11 00:24:08 +00:00
parent ed57536a96
commit 611c7fb1e8
5 changed files with 82 additions and 65 deletions

View File

@@ -2032,6 +2032,19 @@ column 为 third 时可选的 category:
<Route author="nczitzk" example="/interesting-sky/recent-interesting" path="/interesting-sky/recent-interesting"/> <Route author="nczitzk" example="/interesting-sky/recent-interesting" path="/interesting-sky/recent-interesting"/>
## 游戏葡萄
无文章正文,仅有目录索引。
### 全部文章
<Route author="KotoriK" example="/gamegrape" path="/gamegrape/index"/>
### 分类
例子对应[深度分类](http://youxiputao.com/article/index/id/13)
<Route author="KotoriK" example="/gamegrape/13" path="/gamegrape/:id?"/>
## 鱼塘热榜 ## 鱼塘热榜
<Route author="TheresaQWQ" example="/mofish/2" path="/mofish/:id" :paramsDesc="['分类id可以在 https://api.tophub.fun/GetAllType 获取']" /> <Route author="TheresaQWQ" example="/mofish/2" path="/mofish/:id" :paramsDesc="['分类id可以在 https://api.tophub.fun/GetAllType 获取']" />
@@ -2128,13 +2141,3 @@ QueryString:
### 全文 ### 全文
<Route author="HenryQW" example="/zzz" path="/zzz/index"/> <Route author="HenryQW" example="/zzz" path="/zzz/index"/>
## 游戏葡萄
无文章正文,仅有目录索引。
### 全部文章
<Route author="KotoriK" example="/gamegrape" path="/gamegrape/index"/>
### 分类
例子对应[深度分类](http://youxiputao.com/article/index/id/13)
<Route author="KotoriK" example="/gamegrape/13" path="/gamegrape/:id?"/>

View File

@@ -3835,5 +3835,4 @@ router.get('/rfa/:language?/:channel?/:subChannel?', require('./routes/rfa/index
// booth.pm // booth.pm
router.get('/booth.pm/shop/:subdomain', require('./routes/booth-pm/shop')); router.get('/booth.pm/shop/:subdomain', require('./routes/booth-pm/shop'));
module.exports = router; module.exports = router;

View File

@@ -1,34 +1,41 @@
const noFound = 'Auto: Route No Found'; const noFound = 'Auto: Route No Found';
module.exports = ({ github, context, core }, body, number) => {
module.exports = ({github, context, core}, body, number) => {
core.debug(`body: ${body}`); core.debug(`body: ${body}`);
const m = body.match(/```routes\r\n((.|\r\n)*)```/); const m = body.match(/```routes\r\n((.|\r\n)*)```/);
core.debug(`match: ${m}`); core.debug(`match: ${m}`);
let res = null; let res = null;
const removeLabel = () => { const removeLabel = () => {
github.issues.removeLabel({ github.issues
.removeLabel({
issue_number: number, issue_number: number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
name: noFound name: noFound,
}).catch((e) => { core.warning(e); }); })
.catch((e) => {
core.warning(e);
});
}; };
if (m && m[1]) { if (m && m[1]) {
res = m[1].trim().split("\r\n"); res = m[1].trim().split('\r\n');
core.info(`routes detected: ${res}`); core.info(`routes detected: ${res}`);
if (res.length > 0 && res[0] === "NOROUTE") { if (res.length > 0 && res[0] === 'NOROUTE') {
core.info("PR stated no route, passing"); core.info('PR stated no route, passing');
removeLabel(); removeLabel();
github.issues.addLabels({ github.issues
.addLabels({
issue_number: number, issue_number: number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
labels: ['Auto: No Route Needed'] labels: ['Auto: No Route Needed'],
}).catch((e) => { core.warning(e); }); })
.catch((e) => {
core.warning(e);
});
return; return;
} else if (res.length > 0) { } else if (res.length > 0) {
@@ -38,14 +45,14 @@ module.exports = ({github, context, core}, body, number) => {
} }
} }
core.info("seems no route found, failing"); core.info('seems no route found, failing');
github.issues.addLabels({ github.issues.addLabels({
issue_number: number, issue_number: number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
labels: [noFound] labels: [noFound],
}); });
throw "Please follow the PR rules: failed to detect route"; throw 'Please follow the PR rules: failed to detect route';
}; };

View File

@@ -1,6 +1,6 @@
/* eslint-disable */ /* eslint-disable */
module.exports = async ({github, context}, baseUrl, routes, number) => { module.exports = async ({ github, context }, baseUrl, routes, number) => {
if (routes[0] === 'NOROUTE') { if (routes[0] === 'NOROUTE') {
return; return;
} }
@@ -13,10 +13,10 @@ module.exports = async ({github, context}, baseUrl, routes, number) => {
let com = 'Successfully generated as following:\n\n'; let com = 'Successfully generated as following:\n\n';
for (const lks of links) { for (const lks of links) {
console.log("testing route: ", lks) console.log('testing route: ', lks);
// Intended, one at a time // Intended, one at a time
const res = await github.request(`GET ${lks}`).catch(err => { const res = await github.request(`GET ${lks}`).catch((err) => {
com+= ` com += `
<details> <details>
<summary><a href="${lks}">${lks}</a> - **Failed**</summary> <summary><a href="${lks}">${lks}</a> - **Failed**</summary>
@@ -35,23 +35,31 @@ module.exports = async ({github, context}, baseUrl, routes, number) => {
<summary><a href="${lks}">${lks}</a> - Success</summary> <summary><a href="${lks}">${lks}</a> - Success</summary>
\`\`\` \`\`\`
${data.split("\n").slice(0, 30).join("\n")} ${data.split('\n').slice(0, 30).join('\n')}
\`\`\` \`\`\`
</details> </details>
`; `;
} }
} }
github.issues.addLabels({ github.issues
.addLabels({
issue_number: number, issue_number: number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
labels: ['Auto: Route Test Complete'] labels: ['Auto: Route Test Complete'],
}).catch((e) => { core.warning(e) }) })
github.issues.createComment({ .catch((e) => {
core.warning(e);
});
github.issues
.createComment({
issue_number: number, issue_number: number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
body: com body: com,
}).catch((e) => { core.warning(e) }) })
} .catch((e) => {
core.warning(e);
});
};