@@ -4,13 +4,12 @@ import * as path from "path";
4
4
import * as toolrunner from "@actions/exec/lib/toolrunner" ;
5
5
import { IHeaders } from "@actions/http-client/interfaces" ;
6
6
import { default as deepEqual } from "fast-deep-equal" ;
7
- import * as yaml from "js-yaml" ;
8
7
import { default as queryString } from "query-string" ;
9
8
import * as semver from "semver" ;
10
9
11
10
import { isRunningLocalAction , getRelativeScriptPath } from "./actions-util" ;
12
11
import * as api from "./api-client" ;
13
- import { Config , PackWithVersion } from "./config-utils" ;
12
+ import { PackWithVersion } from "./config-utils" ;
14
13
import * as defaults from "./defaults.json" ; // Referenced from codeql-action-sync-tool!
15
14
import { errorMatchers } from "./error-matcher" ;
16
15
import { isTracedLanguage , Language } from "./languages" ;
@@ -81,7 +80,8 @@ export interface CodeQL {
81
80
* Run 'codeql database init --db-cluster'.
82
81
*/
83
82
databaseInitCluster (
84
- config : Config ,
83
+ databasePath : string ,
84
+ languages : Language [ ] ,
85
85
sourceRoot : string ,
86
86
processName : string | undefined ,
87
87
processLevel : number | undefined
@@ -220,7 +220,6 @@ const CODEQL_VERSION_GROUP_RULES = "2.5.5";
220
220
const CODEQL_VERSION_SARIF_GROUP = "2.5.3" ;
221
221
export const CODEQL_VERSION_COUNTS_LINES = "2.6.2" ;
222
222
const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1" ;
223
- const CODEQL_VERSION_CONFIG_FILES = "2.7.3" ;
224
223
export const CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5" ;
225
224
226
225
/**
@@ -693,35 +692,26 @@ async function getCodeQLForCmd(
693
692
] ) ;
694
693
} ,
695
694
async databaseInitCluster (
696
- config : Config ,
695
+ databasePath : string ,
696
+ languages : Language [ ] ,
697
697
sourceRoot : string ,
698
698
processName : string | undefined ,
699
699
processLevel : number | undefined
700
700
) {
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 ) {
705
703
extraArgs . push ( "--begin-tracing" ) ;
706
704
if ( processName !== undefined ) {
707
705
extraArgs . push ( `--trace-process-name=${ processName } ` ) ;
708
706
} 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.
712
707
extraArgs . push ( `--trace-process-level=${ processLevel || 3 } ` ) ;
713
708
}
714
709
}
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
- }
720
710
await runTool ( cmd , [
721
711
"database" ,
722
712
"init" ,
723
713
"--db-cluster" ,
724
- config . dbLocation ,
714
+ databasePath ,
725
715
`--source-root=${ sourceRoot } ` ,
726
716
...extraArgs ,
727
717
...getExtraOptionsFromEnv ( [ "database" , "init" ] ) ,
@@ -874,9 +864,7 @@ async function getCodeQLForCmd(
874
864
if ( extraSearchPath !== undefined ) {
875
865
codeqlArgs . push ( "--additional-packs" , extraSearchPath ) ;
876
866
}
877
- if ( ! ( await util . codeQlVersionAbove ( this , CODEQL_VERSION_CONFIG_FILES ) ) ) {
878
- codeqlArgs . push ( querySuitePath ) ;
879
- }
867
+ codeqlArgs . push ( querySuitePath ) ;
880
868
await runTool ( cmd , codeqlArgs ) ;
881
869
} ,
882
870
async databaseInterpretResults (
@@ -911,10 +899,7 @@ async function getCodeQLForCmd(
911
899
) {
912
900
codeqlArgs . push ( "--sarif-category" , automationDetailsId ) ;
913
901
}
914
- codeqlArgs . push ( databasePath ) ;
915
- if ( ! ( await util . codeQlVersionAbove ( this , CODEQL_VERSION_CONFIG_FILES ) ) ) {
916
- codeqlArgs . push ( ...querySuitePaths ) ;
917
- }
902
+ codeqlArgs . push ( databasePath , ...querySuitePaths ) ;
918
903
// capture stdout, which contains analysis summaries
919
904
return await runTool ( cmd , codeqlArgs ) ;
920
905
} ,
0 commit comments