@@ -12,9 +12,8 @@ import {
1212import {
1313 AnalysisConfig ,
1414 AnalysisKind ,
15- CodeQuality ,
1615 codeQualityQueries ,
17- CodeScanning ,
16+ getAnalysisConfig ,
1817} from "./analyses" ;
1918import * as api from "./api-client" ;
2019import { CachingKind , getCachingKind } from "./caching-utils" ;
@@ -1389,28 +1388,27 @@ export function isCodeQualityEnabled(config: Config): boolean {
13891388}
13901389
13911390/**
1392- * Returns the primary analysis kind that the Action is initialised with. This is
1393- * always `AnalysisKind.CodeScanning` unless `AnalysisKind.CodeScanning` is not enabled .
1391+ * Returns the primary analysis kind that the Action is initialised with. If there is only
1392+ * one analysis kind, then that is returned .
13941393 *
1395- * @returns Returns `AnalysisKind.CodeScanning` if `AnalysisKind.CodeScanning` is enabled;
1396- * otherwise `AnalysisKind.CodeQuality` .
1394+ * The special case is Code Scanning + Code Quality, which can be enabled at the same time.
1395+ * In that case, this function returns Code Scanning .
13971396 */
13981397function getPrimaryAnalysisKind ( config : Config ) : AnalysisKind {
1398+ if ( config . analysisKinds . length === 1 ) {
1399+ return config . analysisKinds [ 0 ] ;
1400+ }
1401+
13991402 return isCodeScanningEnabled ( config )
14001403 ? AnalysisKind . CodeScanning
14011404 : AnalysisKind . CodeQuality ;
14021405}
14031406
14041407/**
1405- * Returns the primary analysis configuration that the Action is initialised with. This is
1406- * always `CodeScanning` unless `CodeScanning` is not enabled.
1407- *
1408- * @returns Returns `CodeScanning` if `AnalysisKind.CodeScanning` is enabled; otherwise `CodeQuality`.
1408+ * Returns the primary analysis configuration that the Action is initialised with.
14091409 */
14101410export function getPrimaryAnalysisConfig ( config : Config ) : AnalysisConfig {
1411- return getPrimaryAnalysisKind ( config ) === AnalysisKind . CodeScanning
1412- ? CodeScanning
1413- : CodeQuality ;
1411+ return getAnalysisConfig ( getPrimaryAnalysisKind ( config ) ) ;
14141412}
14151413
14161414/** Logs the Git version as a telemetry diagnostic. */
0 commit comments