mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
Merge pull request #20752 from asgerf/actions/dont-fail-if-no-js
Actions: don't fail if no JS/TS code was found
This commit is contained in:
@@ -489,13 +489,18 @@ public class AutoBuild {
|
||||
diagnosticsToClose.forEach(DiagnosticWriter::close);
|
||||
}
|
||||
|
||||
if (!hasSeenCode()) {
|
||||
// Fail extraction if no relevant files were found.
|
||||
boolean seenRelevantFiles = EnvironmentVariables.isActionsExtractor()
|
||||
? seenFiles // assume all files are relevant for Actions extractor
|
||||
: hasSeenCode();
|
||||
if (!seenRelevantFiles) {
|
||||
if (seenFiles) {
|
||||
warn("Only found JavaScript or TypeScript files that were empty or contained syntax errors.");
|
||||
} else {
|
||||
warn("No JavaScript or TypeScript code found.");
|
||||
}
|
||||
// ensuring that the finalize steps detects that no code was seen.
|
||||
// Ensuring that the finalize steps detects that no code was seen.
|
||||
// This is necessary to ensure we don't produce an overlay-base database without externs.
|
||||
Path srcFolder = Paths.get(EnvironmentVariables.getWipDatabase(), "src");
|
||||
try {
|
||||
FileUtil8.recursiveDelete(srcFolder);
|
||||
|
||||
@@ -18,6 +18,9 @@ public class EnvironmentVariables {
|
||||
public static final String CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE_ENV_VAR =
|
||||
"CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE";
|
||||
|
||||
public static final String CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE_ENV_VAR =
|
||||
"CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE";
|
||||
|
||||
public static final String CODEQL_DIST_ENV_VAR = "CODEQL_DIST";
|
||||
|
||||
/**
|
||||
@@ -94,4 +97,8 @@ public class EnvironmentVariables {
|
||||
public static String getWipDatabase() {
|
||||
return Env.systemEnv().getNonEmpty(CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE_ENV_VAR);
|
||||
}
|
||||
|
||||
public static boolean isActionsExtractor() {
|
||||
return Env.systemEnv().getNonEmpty(CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE_ENV_VAR) != null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user