Extract query-filters test into a composite action
Removes duplicated yaml. Also add some better typings.
This commit is contained in:
parent
428caf0cf5
commit
59ca9b59cb
4 changed files with 86 additions and 58 deletions
|
|
@ -402,9 +402,9 @@ export async function runQueries(
|
|||
}
|
||||
|
||||
// combine the list of packs into a query suite in order to run them all simultaneously.
|
||||
const querySuite = packs
|
||||
.map(convertPackToQuerySuiteEntry)
|
||||
.concat(queryFilters as any[]);
|
||||
const querySuite = (
|
||||
packs.map(convertPackToQuerySuiteEntry) as configUtils.QuerySuiteEntry[]
|
||||
).concat(queryFilters);
|
||||
|
||||
const querySuitePath = `${databasePath}-queries-${type}.qls`;
|
||||
fs.writeFileSync(querySuitePath, yaml.dump(querySuite));
|
||||
|
|
@ -424,7 +424,9 @@ export async function runQueries(
|
|||
}
|
||||
}
|
||||
|
||||
export function convertPackToQuerySuiteEntry(packStr: string) {
|
||||
export function convertPackToQuerySuiteEntry(
|
||||
packStr: string
|
||||
): configUtils.QuerySuitePackEntry {
|
||||
const pack = configUtils.parsePacksSpecification(packStr);
|
||||
return {
|
||||
qlpack: !pack.path ? pack.name : undefined,
|
||||
|
|
|
|||
|
|
@ -65,6 +65,22 @@ interface IncludeQueryFilter {
|
|||
include: Record<string, string[] | string>;
|
||||
}
|
||||
|
||||
export type QuerySuitePackEntry = {
|
||||
version?: string;
|
||||
} & (
|
||||
| {
|
||||
qlpack: string;
|
||||
}
|
||||
| {
|
||||
from?: string;
|
||||
query?: string;
|
||||
queries?: string;
|
||||
apply?: string;
|
||||
}
|
||||
);
|
||||
|
||||
export type QuerySuiteEntry = QuerySuitePackEntry | QueryFilter;
|
||||
|
||||
/**
|
||||
* Lists of query files for each language.
|
||||
* Will only contain .ql files and not other kinds of files,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue