mirror of
https://github.com/github/codeql-action.git
synced 2026-01-06 22:50:17 +08:00
add example regex match for stdout/err string
This commit is contained in:
27
lib/exec_wrapper.js
generated
27
lib/exec_wrapper.js
generated
@@ -37,12 +37,27 @@ async function exec_wrapper(commandLine, args, options) {
|
||||
}
|
||||
}
|
||||
};
|
||||
const returnCode = await exec.exec(commandLine, args, {
|
||||
listeners: listeners,
|
||||
...options
|
||||
});
|
||||
if (stderr === stdout) {
|
||||
console.log('foo bar');
|
||||
let returnCode;
|
||||
try {
|
||||
returnCode = await exec.exec(commandLine, args, {
|
||||
listeners: listeners,
|
||||
...options
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
returnCode = 1;
|
||||
}
|
||||
if (returnCode === 0) {
|
||||
throw new Error('The exit code was ' + returnCode + '?!');
|
||||
}
|
||||
const regex = new RegExp("(No source code was seen during the build\\.|No JavaScript or TypeScript code found\\.)");
|
||||
if (regex.test(stderr) || regex.test(stdout)) {
|
||||
throw new Error(`No source code was found. This can occur if the specified build commands failed to compile or process any code.
|
||||
- Confirm that there is some source code for the specified language in the project.
|
||||
- For codebases written in Go, JavaScript, TypeScript, and Python, do not specify
|
||||
an explicit --command.
|
||||
- For other languages, the --command must specify a "clean" build which compiles
|
||||
https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning`);
|
||||
}
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user