mirror of
https://github.com/github/codeql-action.git
synced 2025-12-06 15:58:06 +08:00
Compare commits
15 Commits
v2.1.13
...
error-impr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
526f19341b | ||
|
|
ea8c11c723 | ||
|
|
df49e473c8 | ||
|
|
8d49f67955 | ||
|
|
dc2f0c2f5f | ||
|
|
5767c8ebfc | ||
|
|
fde574ae22 | ||
|
|
3b632c3106 | ||
|
|
b63d497b0e | ||
|
|
f1569d58df | ||
|
|
f2c8606b17 | ||
|
|
066d9716c6 | ||
|
|
642850bff5 | ||
|
|
5fa6bd2622 | ||
|
|
278f870907 |
@@ -53,6 +53,6 @@ export function includeAndExcludeAnalysisPaths(config: configUtils.Config, langu
|
||||
config.pathsIgnore.length !== 0 ||
|
||||
filters.length !== 0) &&
|
||||
!languages.every(isInterpretedLanguage)) {
|
||||
core.warning('The "paths"/"paths-ignore" fields of the config only have effect for Javascript and Python');
|
||||
core.warning('The "paths"/"paths-ignore" fields of the configuration only effect Javascript and Python analysis. [Learn more](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#specifying-directories-to-scan) about modifying the directories to scan. );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ async function run() {
|
||||
core.endGroup();
|
||||
|
||||
} catch (error) {
|
||||
core.setFailed("We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. " + error.message);
|
||||
core.setFailed(`We were unable to automatically build your ${language} code. Please replace the call to the autobuild action with your custom build steps. \n` + error.message);
|
||||
await util.reportActionFailed('autobuild', error.message, error.stack);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,19 @@ export interface ResolveQueriesOutput {
|
||||
[queryPath: string]: {}
|
||||
};
|
||||
}
|
||||
|
||||
const options = {
|
||||
ignoreReturnCode: true,
|
||||
failOnStdErr: true,
|
||||
silent:true,
|
||||
listeners: {
|
||||
stdout: (data: Buffer) => {
|
||||
core.debug("Debug" + data.toString());
|
||||
},
|
||||
stderr: (data: Buffer) => {
|
||||
core.error("Error occured" + data.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Environment variable used to store the location of the CodeQL CLI executable.
|
||||
* Value is set by setupCodeQL and read by getCodeQL.
|
||||
@@ -185,10 +197,14 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
||||
'--language=' + language
|
||||
],
|
||||
{
|
||||
silent: true,
|
||||
ignoreReturnCode: true,
|
||||
listeners: {
|
||||
stdout: (data) => { extractorPath += data.toString(); },
|
||||
stderr: (data) => { process.stderr.write(data); }
|
||||
stdout: (data: Buffer) => {
|
||||
core.debug("Debug" + data.toString());
|
||||
},
|
||||
stderr: (data: Buffer) => {
|
||||
core.error("Error occured" + data.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -203,14 +219,15 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
||||
databasePath,
|
||||
'--',
|
||||
traceCommand
|
||||
]);
|
||||
], options);
|
||||
},
|
||||
finalizeDatabase: async function(databasePath: string) {
|
||||
core.debug("Finalizing " + databasePath);
|
||||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'finalize',
|
||||
databasePath
|
||||
]);
|
||||
], options );
|
||||
},
|
||||
resolveQueries: async function(queries: string[]) {
|
||||
let output = '';
|
||||
@@ -221,14 +238,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
||||
'queries',
|
||||
...queries,
|
||||
'--format=bylanguage'
|
||||
],
|
||||
{
|
||||
listeners: {
|
||||
stdout: (data: Buffer) => {
|
||||
output += data.toString();
|
||||
}
|
||||
}
|
||||
});
|
||||
], options);
|
||||
|
||||
return JSON.parse(output);
|
||||
},
|
||||
@@ -243,7 +253,7 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
||||
'--output=' + sarifFile,
|
||||
'--no-sarif-add-snippets',
|
||||
querySuite
|
||||
]);
|
||||
], options);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -128,7 +128,16 @@ async function runQueries(databaseFolder: string, sarifFolder: string, config: c
|
||||
|
||||
const sarifFile = path.join(sarifFolder, database + '.sarif');
|
||||
|
||||
try {
|
||||
await codeql.databaseAnalyze(path.join(databaseFolder, database), sarifFile, querySuite);
|
||||
} catch (analysisError) {
|
||||
core.debug("test test test" + analysisError.message);
|
||||
if (analysisError.message.contains("exit code 32")) {
|
||||
throw new Error('Unable to analyze ' + database + ' because CodeQL was unable to detect any code for that language. \n [Learn more](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning) about how to troubleshoot this error. ');
|
||||
} else {
|
||||
throw new Error(analysisError);
|
||||
}
|
||||
}
|
||||
|
||||
core.debug('SARIF results for database ' + database + ' created at "' + sarifFile + '"');
|
||||
core.endGroup();
|
||||
@@ -136,7 +145,7 @@ async function runQueries(databaseFolder: string, sarifFolder: string, config: c
|
||||
}
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
//try {
|
||||
if (util.should_abort('finish', true) || !await util.reportActionStarting('finish')) {
|
||||
return;
|
||||
}
|
||||
@@ -165,11 +174,11 @@ async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
/*} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
await util.reportActionFailed('finish', error.message, error.stack);
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
await util.reportActionSucceeded('finish');
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ async function run() {
|
||||
// If the languages parameter was not given and no languages were
|
||||
// detected then fail here as this is a workflow configuration error.
|
||||
if (languages.length === 0) {
|
||||
throw new Error("Did not detect any languages to analyze. Please update input in workflow.");
|
||||
throw new Error("Did not detect any languages to analyze. Please [update the languages property](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection) in your workflow definition.");
|
||||
}
|
||||
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config, languages);
|
||||
@@ -243,6 +243,6 @@ async function run() {
|
||||
}
|
||||
|
||||
run().catch(e => {
|
||||
core.setFailed("init action failed: " + e);
|
||||
core.setFailed("Init action failed: " + e);
|
||||
console.log(e);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user