mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
chore(workflow): ping maintainer on matched routes; [skip ci] (#9758)
This commit is contained in:
14
.github/ISSUE_TEMPLATE/bug_report_en.yml
vendored
14
.github/ISSUE_TEMPLATE/bug_report_en.yml
vendored
@@ -9,21 +9,23 @@ body:
|
|||||||
Please ensure you have read [documentation](https://docs.rsshub.app/en), and provide all the information required by this template, otherwise the issue will be closed immediately.
|
Please ensure you have read [documentation](https://docs.rsshub.app/en), and provide all the information required by this template, otherwise the issue will be closed immediately.
|
||||||
Due to the anti-crawling policy implemented by certain websites, some RSS routes provided by the demo will return status code 403. This is not an issue caused by RSSHub and please do not report it.
|
Due to the anti-crawling policy implemented by certain websites, some RSS routes provided by the demo will return status code 403. This is not an issue caused by RSSHub and please do not report it.
|
||||||
|
|
||||||
- type: input
|
- type: textarea
|
||||||
id: routes
|
id: routes
|
||||||
attributes:
|
attributes:
|
||||||
label: Routes
|
label: Routes
|
||||||
description: The involved route, without any parameters
|
description: The involved route, without any parameters, copied directly from the docs "route" field, one link per line.
|
||||||
placeholder: /rsshub/routes
|
placeholder: /rsshub/someroute/:type?
|
||||||
|
render: routes
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: input
|
- type: textarea
|
||||||
id: fullroutes
|
id: fullroutes
|
||||||
attributes:
|
attributes:
|
||||||
label: Full routes
|
label: Full routes
|
||||||
description: The involved route, with all required and optional parameters
|
description: The involved route, with all required and optional parameters, and could be duplicate if necessary (different parameters)
|
||||||
placeholder: /rsshub/routes
|
placeholder: /rsshub/routes/1234?some_extension=mode
|
||||||
|
render: fullroutes
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
|||||||
14
.github/ISSUE_TEMPLATE/bug_report_zh.yml
vendored
14
.github/ISSUE_TEMPLATE/bug_report_zh.yml
vendored
@@ -9,21 +9,23 @@ body:
|
|||||||
请确保已阅读 [文档](https://docs.rsshub.app) 内相关部分,并按照模版提供信息,否则 issue 将被立即关闭。
|
请确保已阅读 [文档](https://docs.rsshub.app) 内相关部分,并按照模版提供信息,否则 issue 将被立即关闭。
|
||||||
由于部分源网站反爬缘故,演示地址一些 RSS 会返回 status code 403,该问题不是 RSSHub 所致,请勿提交 issue。
|
由于部分源网站反爬缘故,演示地址一些 RSS 会返回 status code 403,该问题不是 RSSHub 所致,请勿提交 issue。
|
||||||
|
|
||||||
- type: input
|
- type: textarea
|
||||||
id: routes
|
id: routes
|
||||||
attributes:
|
attributes:
|
||||||
label: 路由地址
|
label: 路由地址
|
||||||
description: 不包含参数
|
description: 不包含参数,复制文档路由参数,一行一个,不要重复
|
||||||
placeholder: /rsshub/routes
|
placeholder: /rsshub/someroute/:type?
|
||||||
|
render: routes
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: input
|
- type: textarea
|
||||||
id: fullroutes
|
id: fullroutes
|
||||||
attributes:
|
attributes:
|
||||||
label: 完整路由地址
|
label: 完整路由地址
|
||||||
description: 包含所有必选与可选参数
|
description: 包含所有必选与可选参数,一行一个,可以有重复路由不同参数(如果需要)
|
||||||
placeholder: /rsshub/routes
|
placeholder: /rsshub/routes/1234?some_extension=mode
|
||||||
|
render: fullroutes
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
|||||||
20
.github/workflows/comment-on-pr.yml
vendored
20
.github/workflows/comment-on-pr.yml
vendored
@@ -5,11 +5,21 @@ on:
|
|||||||
types: [opened]
|
types: [opened]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
comment:
|
testRoute:
|
||||||
|
name: Route test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Comment
|
- uses: actions/checkout@v3
|
||||||
uses: ben-z/actions-comment-on-issue@1.0.2
|
- uses: actions/setup-node@v3 # just need its cache
|
||||||
with:
|
with:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
node-version: 16
|
||||||
message: '👍 感谢提交该 Issue,请确保仔细阅读 [Issue 模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/bug_report_zh.yml),[RSS 提案模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/rss_request_zh.yml) 或 [Feature 提案模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/feature_request_zh.yml) 以便于测试。不符合模板将导致 Issue 被直接关闭。<br /><br />👍 Thanks for the issue, please follow the [Issue template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/bug_report_en.yml), [RSS proposal template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/rss_request_en.yml) or [Feature proposal template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/feature_request_en.yml). Otherwise the issue will be closed.'
|
cache: 'yarn'
|
||||||
|
- name: Install dependencies (yarn) # needed since we need to parse markdown, so we also use got instead
|
||||||
|
run: yarn
|
||||||
|
- name: Generate feedback
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
script: |
|
||||||
|
const script = require(`${process.env.GITHUB_WORKSPACE}/scripts/workflow/test-issue/find-maintainer.js`)
|
||||||
|
return await script({ github, context, core })
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<iframe width="640" height="360" src="https://player.vimeo.com/video{{ videoUrl }}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
<iframe width="640" height="360" src="https://player.vimeo.com/video{{ videoUrl }}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
||||||
{{ if vdescription }}
|
{{ if vdescription }}
|
||||||
<p>{{@ vdescription }}</p>
|
<p>{{@ vdescription }}</p>
|
||||||
{{ /if }}
|
{{ /if }}
|
||||||
|
|||||||
@@ -65,12 +65,14 @@
|
|||||||
"remark-frontmatter": "3.0.0",
|
"remark-frontmatter": "3.0.0",
|
||||||
"remark-gfm": "1.0.0",
|
"remark-gfm": "1.0.0",
|
||||||
"remark-pangu": "2.2.0",
|
"remark-pangu": "2.2.0",
|
||||||
|
"remark-parse": "9.0.0",
|
||||||
"remark-preset-prettier": "0.5.1",
|
"remark-preset-prettier": "0.5.1",
|
||||||
"remark-stringify": "9.0.1",
|
"remark-stringify": "9.0.1",
|
||||||
"staged-git-files": "1.3.0",
|
"staged-git-files": "1.3.0",
|
||||||
"string-width": "4.2.3",
|
"string-width": "4.2.3",
|
||||||
"supertest": "6.2.3",
|
"supertest": "6.2.3",
|
||||||
"tosource": "2.0.0-alpha.3",
|
"tosource": "2.0.0-alpha.3",
|
||||||
|
"unified": "9.2.2",
|
||||||
"vuepress": "1.9.7",
|
"vuepress": "1.9.7",
|
||||||
"yorkie": "2.0.0"
|
"yorkie": "2.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
162
scripts/workflow/test-issue/find-maintainer.js
Normal file
162
scripts/workflow/test-issue/find-maintainer.js
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
const unified = require('unified')
|
||||||
|
const parse = require('remark-parse')
|
||||||
|
const got = require('got')
|
||||||
|
|
||||||
|
// @TODO maybe we could use label or better way to separate bug/feature stuff
|
||||||
|
const matchTitle = ["路由地址", "Routes"]
|
||||||
|
const maintainerURL = "https://raw.githubusercontent.com/DIYgod/RSSHub/gh-pages/build/maintainer.json";
|
||||||
|
const successTag = 'Bug Ping: Pinged';
|
||||||
|
const parseFailure = 'Bug Ping: Parse Failure'
|
||||||
|
const failTag = 'Bug Ping: Not Found'
|
||||||
|
const ignoreUsername = new Set([]); // Wrap user who don't want to be pinged.
|
||||||
|
|
||||||
|
async function parseBodyRoutes(body, core) {
|
||||||
|
const ast = await unified().use(parse).parse(body)
|
||||||
|
|
||||||
|
// Is this a bug report?
|
||||||
|
const title = ast.children[0].children[0].value.trim()
|
||||||
|
core.debug(`title: ${title}`);
|
||||||
|
if (!matchTitle.some((ele) => ele.localeCompare(title) === 0)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const routes = ast.children[1].value
|
||||||
|
core.debug(`routes: ${JSON.stringify(routes)}`);
|
||||||
|
|
||||||
|
if (routes) {
|
||||||
|
const dedup = [...new Set(routes.trim().split(/\r?\n/).filter(n => n))]
|
||||||
|
if (dedup.length !== routes.length) {
|
||||||
|
core.warning("Duplicate Detected.")
|
||||||
|
}
|
||||||
|
core.debug(dedup)
|
||||||
|
return dedup
|
||||||
|
}
|
||||||
|
|
||||||
|
throw "unable to parse body: routes does not exist"
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getMaintainersByRoutes(routes, core) {
|
||||||
|
const maintainers = await got(maintainerURL).json()
|
||||||
|
|
||||||
|
return routes.map(e => {
|
||||||
|
const m = maintainers[e]
|
||||||
|
if (m !== undefined) {
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
core.warning(`Route ${e} does not match any maintainer`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = async ({ github, context, core }) => {
|
||||||
|
const body = context.payload.issue.body
|
||||||
|
const issue_facts = {
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
};
|
||||||
|
|
||||||
|
const routes = await parseBodyRoutes(body, core).catch(e => {
|
||||||
|
core.warning(e)
|
||||||
|
})
|
||||||
|
|
||||||
|
if (routes === null) {
|
||||||
|
return // Not a bug
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (routes === undefined) {
|
||||||
|
await github.rest.issues
|
||||||
|
.addLabels({
|
||||||
|
...issue_facts,
|
||||||
|
labels: [
|
||||||
|
parseFailure
|
||||||
|
],
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
core.warning(e);
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const maintainers = await getMaintainersByRoutes(routes, core)
|
||||||
|
|
||||||
|
let successCount = 0
|
||||||
|
let comments = "##### Trying to find maintainers: \n\n"
|
||||||
|
|
||||||
|
for (let i = 0; i < routes.length; i++) {
|
||||||
|
const route = routes[i]
|
||||||
|
const main = maintainers[i]
|
||||||
|
if (main === undefined) {
|
||||||
|
comments += `- \`${route}\`: **Not found in list**\n`
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (main.length === 0) {
|
||||||
|
comments += `- \`${route}\`: No maintainer listed, possibly v1 route or misconfigure\n`
|
||||||
|
successCount += 1
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (main.length > 0) {
|
||||||
|
const pingStr = main.map(e => {
|
||||||
|
if (e in ignoreUsername) {
|
||||||
|
return `\`@${e}\`` // Wrap with code so no mention will be sent
|
||||||
|
}
|
||||||
|
return `@${e}`
|
||||||
|
}).join(" ")
|
||||||
|
comments += `- \`${route}\`: ${pingStr}\n`
|
||||||
|
successCount += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Send out notification
|
||||||
|
await github.rest.issues
|
||||||
|
.createComment({
|
||||||
|
...issue_facts,
|
||||||
|
body: `${comments}
|
||||||
|
|
||||||
|
|
||||||
|
> 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.
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
core.warning(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (successCount === routes.length) {
|
||||||
|
await github.rest.issues
|
||||||
|
.addLabels({
|
||||||
|
...issue_facts,
|
||||||
|
labels: [
|
||||||
|
successTag
|
||||||
|
],
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
core.warning(e);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await github.rest.issues
|
||||||
|
.addLabels({
|
||||||
|
...issue_facts,
|
||||||
|
labels: [
|
||||||
|
failTag
|
||||||
|
],
|
||||||
|
})
|
||||||
|
.catch((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);
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -11683,7 +11683,7 @@ remark-pangu@2.2.0:
|
|||||||
unist-util-is "^4.0.2"
|
unist-util-is "^4.0.2"
|
||||||
unist-util-visit "^2.0.2"
|
unist-util-visit "^2.0.2"
|
||||||
|
|
||||||
remark-parse@^9.0.0:
|
remark-parse@9.0.0, remark-parse@^9.0.0:
|
||||||
version "9.0.0"
|
version "9.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-9.0.0.tgz#4d20a299665880e4f4af5d90b7c7b8a935853640"
|
resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-9.0.0.tgz#4d20a299665880e4f4af5d90b7c7b8a935853640"
|
||||||
integrity sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==
|
integrity sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==
|
||||||
@@ -13449,7 +13449,7 @@ unicode-property-aliases-ecmascript@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz#0a36cb9a585c4f6abd51ad1deddb285c165297c8"
|
resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz#0a36cb9a585c4f6abd51ad1deddb285c165297c8"
|
||||||
integrity sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==
|
integrity sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==
|
||||||
|
|
||||||
unified@^9.1.0:
|
unified@9.2.2, unified@^9.1.0:
|
||||||
version "9.2.2"
|
version "9.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/unified/-/unified-9.2.2.tgz#67649a1abfc3ab85d2969502902775eb03146975"
|
resolved "https://registry.yarnpkg.com/unified/-/unified-9.2.2.tgz#67649a1abfc3ab85d2969502902775eb03146975"
|
||||||
integrity sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==
|
integrity sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==
|
||||||
|
|||||||
Reference in New Issue
Block a user