@@ -4,13 +4,12 @@ import * as path from "path";
44import * as toolrunner from "@actions/exec/lib/toolrunner" ;
55import { IHeaders } from "@actions/http-client/interfaces" ;
66import { default as deepEqual } from "fast-deep-equal" ;
7- import * as yaml from "js-yaml" ;
87import { default as queryString } from "query-string" ;
98import * as semver from "semver" ;
109
1110import { isRunningLocalAction , getRelativeScriptPath } from "./actions-util" ;
1211import * as api from "./api-client" ;
13- import { Config , PackWithVersion } from "./config-utils" ;
12+ import { PackWithVersion } from "./config-utils" ;
1413import * as defaults from "./defaults.json" ; // Referenced from codeql-action-sync-tool!
1514import { errorMatchers } from "./error-matcher" ;
1615import { isTracedLanguage , Language } from "./languages" ;
@@ -81,7 +80,8 @@ export interface CodeQL {
8180 * Run 'codeql database init --db-cluster'.
8281 */
8382 databaseInitCluster (
84- config : Config ,
83+ databasePath : string ,
84+ languages : Language [ ] ,
8585 sourceRoot : string ,
8686 processName : string | undefined ,
8787 processLevel : number | undefined
@@ -220,7 +220,6 @@ const CODEQL_VERSION_GROUP_RULES = "2.5.5";
220220const CODEQL_VERSION_SARIF_GROUP = "2.5.3" ;
221221export const CODEQL_VERSION_COUNTS_LINES = "2.6.2" ;
222222const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1" ;
223- const CODEQL_VERSION_CONFIG_FILES = "2.7.3" ;
224223export const CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5" ;
225224
226225/**
@@ -693,35 +692,26 @@ async function getCodeQLForCmd(
693692 ] ) ;
694693 } ,
695694 async databaseInitCluster (
696- config : Config ,
695+ databasePath : string ,
696+ languages : Language [ ] ,
697697 sourceRoot : string ,
698698 processName : string | undefined ,
699699 processLevel : number | undefined
700700 ) {
701- const extraArgs = config . languages . map (
702- ( language ) => `--language=${ language } `
703- ) ;
704- if ( config . languages . filter ( isTracedLanguage ) . length > 0 ) {
701+ const extraArgs = languages . map ( ( language ) => `--language=${ language } ` ) ;
702+ if ( languages . filter ( isTracedLanguage ) . length > 0 ) {
705703 extraArgs . push ( "--begin-tracing" ) ;
706704 if ( processName !== undefined ) {
707705 extraArgs . push ( `--trace-process-name=${ processName } ` ) ;
708706 } else {
709- // We default to 3 if no other arguments are provided since this was the default
710- // behaviour of the Runner. Note this path never happens in the CodeQL Action
711- // because that always passes in a process name.
712707 extraArgs . push ( `--trace-process-level=${ processLevel || 3 } ` ) ;
713708 }
714709 }
715- if ( await util . codeQlVersionAbove ( codeql , CODEQL_VERSION_CONFIG_FILES ) ) {
716- const configLocation = path . resolve ( config . tempDir , "user-config.yaml" ) ;
717- fs . writeFileSync ( configLocation , yaml . dump ( config . originalUserInput ) ) ;
718- extraArgs . push ( `--codescanning-config=${ configLocation } ` ) ;
719- }
720710 await runTool ( cmd , [
721711 "database" ,
722712 "init" ,
723713 "--db-cluster" ,
724- config . dbLocation ,
714+ databasePath ,
725715 `--source-root=${ sourceRoot } ` ,
726716 ...extraArgs ,
727717 ...getExtraOptionsFromEnv ( [ "database" , "init" ] ) ,
@@ -874,9 +864,7 @@ async function getCodeQLForCmd(
874864 if ( extraSearchPath !== undefined ) {
875865 codeqlArgs . push ( "--additional-packs" , extraSearchPath ) ;
876866 }
877- if ( ! ( await util . codeQlVersionAbove ( this , CODEQL_VERSION_CONFIG_FILES ) ) ) {
878- codeqlArgs . push ( querySuitePath ) ;
879- }
867+ codeqlArgs . push ( querySuitePath ) ;
880868 await runTool ( cmd , codeqlArgs ) ;
881869 } ,
882870 async databaseInterpretResults (
@@ -911,10 +899,7 @@ async function getCodeQLForCmd(
911899 ) {
912900 codeqlArgs . push ( "--sarif-category" , automationDetailsId ) ;
913901 }
914- codeqlArgs . push ( databasePath ) ;
915- if ( ! ( await util . codeQlVersionAbove ( this , CODEQL_VERSION_CONFIG_FILES ) ) ) {
916- codeqlArgs . push ( ...querySuitePaths ) ;
917- }
902+ codeqlArgs . push ( databasePath , ...querySuitePaths ) ;
918903 // capture stdout, which contains analysis summaries
919904 return await runTool ( cmd , codeqlArgs ) ;
920905 } ,
0 commit comments