2023-04-12 04:55:44 +08:00
name : Check For Common Issues
on :
issues :
types :
- opened
jobs :
2023-06-28 16:13:10 +08:00
check-for-common-issues :
2023-04-12 04:55:44 +08:00
runs-on : ubuntu-latest
permissions :
issues : write
steps :
2024-02-02 06:59:24 +08:00
- uses : actions/github-script@v7
2023-04-12 04:55:44 +08:00
with :
script : |
let issue_query = {
issue_number : context.issue.number,
owner : context.repo.owner,
repo : context.repo.repo
};
let issue = await github.rest.issues.get(issue_query)
2024-10-29 03:33:53 +08:00
let issue_body = issue.data.body.replaceAll("\r\n", "\n");
2024-02-16 15:59:09 +08:00
let commentLabelClose = async (comment, label) => {
await github.rest.issues.removeAllLabels(issue_query);
await github.rest.issues.setLabels({...issue_query, labels: [label]});
await github.rest.issues.createComment({...issue_query, body: comment});
await github.rest.issues.update({...issue_query, state: "closed"});
}
2023-06-28 16:13:10 +08:00
// missing-windows-sdk-issue
2023-04-12 04:55:44 +08:00
let reg = /RC Pass 1 : command "rc .*" failed \(exit code 0\) with the following output:/;
2024-10-29 03:33:53 +08:00
if (reg.test(issue_body)){
2023-04-12 04:55:44 +08:00
let body = "Thanks for posting this issue. Please make sure you have the following installed.\n" +
"- Visual Studio Desktop development with C++.\n" +
"- Windows 10 SDK or Windows 11 SDK." ;
2024-02-16 15:59:09 +08:00
return await commentLabelClose(body, "category:question");
2023-04-12 04:55:44 +08:00
}
2023-06-28 16:13:10 +08:00
// msys2 download fails => old vcpkg version
reg = /error: https:\/\/repo\.msys2\.org\/.*: failed : status code 404/;
2024-10-29 03:33:53 +08:00
if (reg.test(issue_body)){
2023-06-28 16:13:10 +08:00
let body = "Try updating your vcpkg version via `git pull` to resolve this issue. MSYS2 downloads are removed from the upstream servers from time to time, so using an up-to-date vcpkg version is necessary."
2024-02-16 15:59:09 +08:00
return await commentLabelClose(body, "category:question");
2023-06-28 16:13:10 +08:00
}
2024-02-07 05:58:20 +08:00
2024-11-01 06:33:52 +08:00
regs = []
2024-02-07 05:58:20 +08:00
// Issue text is : Copy issue body from .../issue_body.md
2024-11-01 06:33:52 +08:00
regs.push( /^Copy issue body from .*issue_body.md$/ );
2024-02-16 15:59:09 +08:00
// Issue to short like #36592 or #36668
2024-11-01 06:33:52 +08:00
regs.push( /^error : building.* BUILD_FAILED\r\nElapsed time.*\r\nPlease ensure.*(\r\nThen check .*\r\n.*)?$/ );
// Issues with only the default error message like #41813
regs.push( /^error : building.* BUILD_FAILED\r\n[\s\S]*issue_body.md$/ );
if (regs.some(reg => reg.test(issue_body))) {
2024-02-16 15:59:09 +08:00
let body = "Please see #30604 for how to report a build failure."
return await commentLabelClose(body, "requires:more-information");
2024-02-07 05:58:20 +08:00
}
// pkg-config/ not found issues like #36011
2024-10-29 03:33:53 +08:00
reg = /CMake Error at scripts\/cmake\/vcpkg_find_acquire_program.*\n(.*Please install it via your package manager:[\s\S]+)Call Stack/;
match = issue_body.match(reg)
2024-02-07 05:58:20 +08:00
if (match){
let body = "From the log:\n```\n" + match[1] + "```\n"
2024-02-16 15:59:09 +08:00
return await commentLabelClose(body, "category:question");
}
// MSVC internal compiler error like #36628
2024-10-29 03:33:53 +08:00
if (issue_body.indexOf("fatal error C1001: Internal compiler error") !== -1){
2024-02-16 15:59:09 +08:00
let body = "The build failed due to an internal compiler error. Please update your compiler or revert to an old version."
return await commentLabelClose(body, "category:question");
2024-02-07 05:58:20 +08:00
}
2024-03-05 18:07:49 +08:00
// configure: error : 'autoconf-archive' is missing like #37013
2024-10-29 03:33:53 +08:00
if (issue_body.indexOf("configure: error: 'autoconf-archive' is missing") !== -1){
2024-03-05 18:07:49 +08:00
let body = "Please install `autoconf-archive` via `brew install autoconf-archive` (macos) or `sudo apt-get install autoconf-archive` (linux)"
return await commentLabelClose(body, "category:question");
}
2024-10-29 14:45:40 +08:00
// Wrong formatted issues like #36086
const containsCopyHint = issue_body.indexOf("Copy issue body from") !== -1 || issue_body.indexOf("%2Fissue_body.md") !== -1;
if (containsCopyHint && issue_body.indexOf("```") === -1){
let body = "Please see #30604 for how to properly report a build failure."
return await github.rest.issues.createComment({...issue_query, body: body});
}