chore(*): migrate to GHA-based PR route test (#9683)

Signed-off-by: Rongrong <i@rong.moe>
This commit is contained in:
Rongrong
2022-05-03 19:24:27 +08:00
committed by GitHub
parent 569b7d8db1
commit 7b6589cafa
4 changed files with 89 additions and 36 deletions

View File

@@ -1,6 +1,6 @@
/* eslint-disable */
module.exports = async ({ github, context, core }, baseUrl, routes, number) => {
module.exports = async ({ github, context, core, got }, baseUrl, routes, number) => {
if (routes[0] === 'NOROUTE') {
return;
}
@@ -15,27 +15,26 @@ module.exports = async ({ github, context, core }, baseUrl, routes, number) => {
for (const lks of links) {
core.info(`testing route: ${lks}`);
// Intended, one at a time
const res = await github.request(`GET ${lks}`).catch((err) => {
const res = await got(lks).catch((err) => {
com += `
<details>
<summary><a href="${lks}">${lks}</a> - **Failed**</summary>
<summary><a href="${lks}">${lks}</a> - <b>Failed</b></summary>
\`\`\`
${err}
${err}
\`\`\`
</details>
`;
});
if (res && res.data) {
const { data } = res;
if (res && res.body) {
const { body } = res;
com += `
<details>
<summary><a href="${lks}">${lks}</a> - Success</summary>
<summary><a href="${lks}">${lks}</a> - Success</summary>
\`\`\`
${data.split('\n').slice(0, 30).join('\n')}
\`\`\`rss
${body.replace(/\s+(\n|$)/g, '\n')}
\`\`\`
</details>