mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Treat status reports as non-critical
Change `sendStatusReport` to `void`
This commit is contained in:
36
lib/upload-lib.js
generated
36
lib/upload-lib.js
generated
@@ -40,6 +40,8 @@ const fingerprints = __importStar(require("./fingerprints"));
|
||||
const repository_1 = require("./repository");
|
||||
const util = __importStar(require("./util"));
|
||||
const util_1 = require("./util");
|
||||
const GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
|
||||
const GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
|
||||
// Takes a list of paths to sarif files and combines them together,
|
||||
// returning the contents of the combined sarif file.
|
||||
function combineSarifFiles(sarifFiles) {
|
||||
@@ -100,14 +102,32 @@ async function uploadPayload(payload, repositoryNwo, logger) {
|
||||
return;
|
||||
}
|
||||
const client = api.getApiClient();
|
||||
const response = await client.request("PUT /repos/:owner/:repo/code-scanning/analysis", {
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
data: payload,
|
||||
});
|
||||
logger.debug(`response status: ${response.status}`);
|
||||
logger.info("Successfully uploaded results");
|
||||
return response.data.id;
|
||||
try {
|
||||
const response = await client.request("PUT /repos/:owner/:repo/code-scanning/analysis", {
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
data: payload,
|
||||
});
|
||||
logger.debug(`response status: ${response.status}`);
|
||||
logger.info("Successfully uploaded results");
|
||||
return response.data.id;
|
||||
}
|
||||
catch (e) {
|
||||
if (util.isHTTPError(e)) {
|
||||
switch (e.status) {
|
||||
case 403:
|
||||
core.warning(e.message || GENERIC_403_MSG);
|
||||
break;
|
||||
case 404:
|
||||
core.warning(e.message || GENERIC_404_MSG);
|
||||
break;
|
||||
default:
|
||||
core.warning(e.message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
// Recursively walks a directory and returns all SARIF files it finds.
|
||||
// Does not follow symlinks.
|
||||
|
||||
Reference in New Issue
Block a user