File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -489,13 +489,18 @@ public int run() throws IOException {
489489 diagnosticsToClose .forEach (DiagnosticWriter ::close );
490490 }
491491
492- if (!hasSeenCode ()) {
492+ // Fail extraction if no relevant files were found.
493+ boolean seenRelevantFiles = EnvironmentVariables .isActionsExtractor ()
494+ ? seenFiles // assume all files are relevant for Actions extractor
495+ : hasSeenCode ();
496+ if (!seenRelevantFiles ) {
493497 if (seenFiles ) {
494498 warn ("Only found JavaScript or TypeScript files that were empty or contained syntax errors." );
495499 } else {
496500 warn ("No JavaScript or TypeScript code found." );
497501 }
498- // ensuring that the finalize steps detects that no code was seen.
502+ // Ensuring that the finalize steps detects that no code was seen.
503+ // This is necessary to ensure we don't produce an overlay-base database without externs.
499504 Path srcFolder = Paths .get (EnvironmentVariables .getWipDatabase (), "src" );
500505 try {
501506 FileUtil8 .recursiveDelete (srcFolder );
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ public class EnvironmentVariables {
1818 public static final String CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE_ENV_VAR =
1919 "CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE" ;
2020
21+ public static final String CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE_ENV_VAR =
22+ "CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE" ;
23+
2124 public static final String CODEQL_DIST_ENV_VAR = "CODEQL_DIST" ;
2225
2326 /**
@@ -94,4 +97,8 @@ public static String getCodeQLDist() {
9497 public static String getWipDatabase () {
9598 return Env .systemEnv ().getNonEmpty (CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE_ENV_VAR );
9699 }
100+
101+ public static boolean isActionsExtractor () {
102+ return Env .systemEnv ().getNonEmpty (CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE_ENV_VAR ) != null ;
103+ }
97104}
You can’t perform that action at this time.
0 commit comments