Skip to content

Commit da92996

Browse files
committed
Move InitStatusReport types to status-report.ts
1 parent f2e20f5 commit da92996

File tree

2 files changed

+46
-43
lines changed

2 files changed

+46
-43
lines changed

src/init-action.ts

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ import { getRepositoryNwo } from "./repository";
5151
import { ToolsSource } from "./setup-codeql";
5252
import {
5353
ActionName,
54-
StatusReportBase,
54+
InitStatusReport,
55+
InitWithConfigStatusReport,
5556
createStatusReportBase,
5657
getActionsStatus,
5758
sendStatusReport,
@@ -78,48 +79,6 @@ import {
7879
getErrorMessage,
7980
} from "./util";
8081
import { validateWorkflow } from "./workflow";
81-
/** Fields of the init status report that can be sent before `config` is populated. */
82-
interface InitStatusReport extends StatusReportBase {
83-
/** Value given by the user as the "tools" input. */
84-
tools_input: string;
85-
/** Version of the bundle used. */
86-
tools_resolved_version: string;
87-
/** Where the bundle originated from. */
88-
tools_source: ToolsSource;
89-
/** Comma-separated list of languages specified explicitly in the workflow file. */
90-
workflow_languages: string;
91-
}
92-
93-
/** Fields of the init status report that are populated using values from `config`. */
94-
interface InitWithConfigStatusReport extends InitStatusReport {
95-
/** Comma-separated list of languages where the default queries are disabled. */
96-
disable_default_queries: string;
97-
/** Comma-separated list of paths, from the 'paths' config field. */
98-
paths: string;
99-
/** Comma-separated list of paths, from the 'paths-ignore' config field. */
100-
paths_ignore: string;
101-
/** Comma-separated list of queries sources, from the 'queries' config field or workflow input. */
102-
queries: string;
103-
/** Stringified JSON object of packs, from the 'packs' config field or workflow input. */
104-
packs: string;
105-
/** Comma-separated list of languages for which we are using TRAP caching. */
106-
trap_cache_languages: string;
107-
/** Size of TRAP caches that we downloaded, in bytes. */
108-
trap_cache_download_size_bytes: number;
109-
/** Time taken to download TRAP caches, in milliseconds. */
110-
trap_cache_download_duration_ms: number;
111-
/** Size of the overlay-base database that we downloaded, in bytes. */
112-
overlay_base_database_download_size_bytes?: number;
113-
/** Time taken to download the overlay-base database, in milliseconds. */
114-
overlay_base_database_download_duration_ms?: number;
115-
/** Stringified JSON array of registry configuration objects, from the 'registries' config field
116-
or workflow input. **/
117-
registries: string;
118-
/** Stringified JSON object representing a query-filters, from the 'query-filters' config field. **/
119-
query_filters: string;
120-
/** Path to the specified code scanning config file, from the 'config-file' config field. */
121-
config_file: string;
122-
}
12382

12483
/** Fields of the init status report populated when the tools source is `download`. */
12584
interface InitToolsDownloadFields {

src/status-report.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { EnvVar } from "./environment";
1818
import { getRef } from "./git-utils";
1919
import { Logger } from "./logging";
2020
import { getRepositoryNwo } from "./repository";
21+
import { ToolsSource } from "./setup-codeql";
2122
import {
2223
ConfigurationError,
2324
isHTTPError,
@@ -460,3 +461,46 @@ export async function sendStatusReport<S extends StatusReportBase>(
460461
);
461462
}
462463
}
464+
465+
/** Fields of the init status report that can be sent before `config` is populated. */
466+
export interface InitStatusReport extends StatusReportBase {
467+
/** Value given by the user as the "tools" input. */
468+
tools_input: string;
469+
/** Version of the bundle used. */
470+
tools_resolved_version: string;
471+
/** Where the bundle originated from. */
472+
tools_source: ToolsSource;
473+
/** Comma-separated list of languages specified explicitly in the workflow file. */
474+
workflow_languages: string;
475+
}
476+
477+
/** Fields of the init status report that are populated using values from `config`. */
478+
export interface InitWithConfigStatusReport extends InitStatusReport {
479+
/** Comma-separated list of languages where the default queries are disabled. */
480+
disable_default_queries: string;
481+
/** Comma-separated list of paths, from the 'paths' config field. */
482+
paths: string;
483+
/** Comma-separated list of paths, from the 'paths-ignore' config field. */
484+
paths_ignore: string;
485+
/** Comma-separated list of queries sources, from the 'queries' config field or workflow input. */
486+
queries: string;
487+
/** Stringified JSON object of packs, from the 'packs' config field or workflow input. */
488+
packs: string;
489+
/** Comma-separated list of languages for which we are using TRAP caching. */
490+
trap_cache_languages: string;
491+
/** Size of TRAP caches that we downloaded, in bytes. */
492+
trap_cache_download_size_bytes: number;
493+
/** Time taken to download TRAP caches, in milliseconds. */
494+
trap_cache_download_duration_ms: number;
495+
/** Size of the overlay-base database that we downloaded, in bytes. */
496+
overlay_base_database_download_size_bytes?: number;
497+
/** Time taken to download the overlay-base database, in milliseconds. */
498+
overlay_base_database_download_duration_ms?: number;
499+
/** Stringified JSON array of registry configuration objects, from the 'registries' config field
500+
or workflow input. **/
501+
registries: string;
502+
/** Stringified JSON object representing a query-filters, from the 'query-filters' config field. **/
503+
query_filters: string;
504+
/** Path to the specified code scanning config file, from the 'config-file' config field. */
505+
config_file: string;
506+
}

0 commit comments

Comments
 (0)