Skip to content

Commit 009715d

Browse files
committed
Add github-codeql-tools property
1 parent 0c76f63 commit 009715d

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

lib/entry-points.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/feature-flags/properties.test.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,17 @@ test.serial(
7272
);
7373

7474
test.serial("loadPropertiesFromApi loads known properties", async (t) => {
75+
const knownProperties = [
76+
{ property_name: "github-codeql-config-file", value: "owner/repo" },
77+
{ property_name: "github-codeql-extra-queries", value: "+queries" },
78+
{ property_name: "github-codeql-tools", value: "nightly" },
79+
];
7580
sinon.stub(api, "getRepositoryProperties").resolves({
7681
headers: {},
7782
status: 200,
7883
url: "",
7984
data: [
80-
{ property_name: "github-codeql-config-file", value: "owner/repo" },
81-
{ property_name: "github-codeql-extra-queries", value: "+queries" },
85+
...knownProperties,
8286
{ property_name: "unknown-property", value: "something" },
8387
] satisfies properties.GitHubPropertiesResponse,
8488
});
@@ -88,10 +92,12 @@ test.serial("loadPropertiesFromApi loads known properties", async (t) => {
8892
logger,
8993
mockRepositoryNwo,
9094
);
91-
t.deepEqual(response, {
92-
"github-codeql-config-file": "owner/repo",
93-
"github-codeql-extra-queries": "+queries",
94-
});
95+
t.deepEqual(
96+
response,
97+
Object.fromEntries(
98+
knownProperties.map((prop) => [prop.property_name, prop.value]),
99+
),
100+
);
95101
});
96102

97103
test.serial("loadPropertiesFromApi parses true boolean property", async (t) => {

src/feature-flags/properties.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export enum RepositoryPropertyName {
1414
DISABLE_OVERLAY = "github-codeql-disable-overlay",
1515
EXTRA_QUERIES = "github-codeql-extra-queries",
1616
FILE_COVERAGE_ON_PRS = "github-codeql-file-coverage-on-prs",
17+
TOOLS = "github-codeql-tools",
1718
}
1819

1920
/** Parsed types of the known repository properties. */
@@ -22,6 +23,7 @@ export type AllRepositoryProperties = {
2223
[RepositoryPropertyName.DISABLE_OVERLAY]: boolean;
2324
[RepositoryPropertyName.EXTRA_QUERIES]: string;
2425
[RepositoryPropertyName.FILE_COVERAGE_ON_PRS]: boolean;
26+
[RepositoryPropertyName.TOOLS]: string;
2527
};
2628

2729
/** Parsed repository properties. */
@@ -33,6 +35,7 @@ export type RepositoryPropertyApiType = {
3335
[RepositoryPropertyName.DISABLE_OVERLAY]: string;
3436
[RepositoryPropertyName.EXTRA_QUERIES]: string;
3537
[RepositoryPropertyName.FILE_COVERAGE_ON_PRS]: string;
38+
[RepositoryPropertyName.TOOLS]: string;
3639
};
3740

3841
/** The type of functions which take the `value` from the API and try to convert it to the type we want. */
@@ -81,6 +84,7 @@ const repositoryPropertyParsers: {
8184
[RepositoryPropertyName.DISABLE_OVERLAY]: booleanProperty,
8285
[RepositoryPropertyName.EXTRA_QUERIES]: stringProperty,
8386
[RepositoryPropertyName.FILE_COVERAGE_ON_PRS]: booleanProperty,
87+
[RepositoryPropertyName.TOOLS]: stringProperty,
8488
};
8589

8690
/**

0 commit comments

Comments
 (0)