Skip to content

Commit e7ec96c

Browse files
committed
Remove isTruthy: consistently use booleans in templates
1 parent 41d5a06 commit e7ec96c

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

pr-checks/checks/autobuild-direct-tracing-with-working-dir.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: >
55
autobuild Action.
66
operatingSystems: ["ubuntu", "windows"]
77
versions: ["linked", "nightly-latest"]
8-
installJava: "true"
8+
installJava: true
99
env:
1010
CODEQL_ACTION_AUTOBUILD_BUILD_MODE_DIRECT_TRACING: true
1111
steps:

pr-checks/checks/build-mode-autobuild.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: "Build mode autobuild"
22
description: "An end-to-end integration test of a Java repository built using 'build-mode: autobuild'"
33
operatingSystems: ["ubuntu", "windows"]
44
versions: ["linked", "nightly-latest"]
5-
installJava: "true"
6-
installYq: "true"
5+
installJava: true
6+
installYq: true
77
steps:
88
- name: Set up Java test repo configuration
99
run: |

pr-checks/sync.ts

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ interface Specification {
3434
/** Values for the `analysis-kinds` matrix dimension. */
3535
analysisKinds?: string[];
3636

37-
installNode?: string | boolean;
38-
installGo?: string | boolean;
39-
installJava?: string | boolean;
40-
installPython?: string | boolean;
41-
installDotNet?: string | boolean;
42-
installYq?: string | boolean;
37+
installNode?: boolean;
38+
installGo?: boolean;
39+
installJava?: boolean;
40+
installPython?: boolean;
41+
installDotNet?: boolean;
42+
installYq?: boolean;
4343

4444
/** Container image configuration for the job. */
4545
container?: any;
@@ -113,13 +113,6 @@ function writeYaml(filePath: string, workflow: any): void {
113113
fs.writeFileSync(filePath, stripTrailingWhitespace(header + yamlStr), "utf8");
114114
}
115115

116-
function isTruthy(value: string | boolean | undefined): boolean {
117-
if (typeof value === "string") {
118-
return value.toLowerCase() === "true";
119-
}
120-
return Boolean(value);
121-
}
122-
123116
/**
124117
* Strip trailing whitespace from each line.
125118
*/
@@ -220,7 +213,7 @@ function main(): void {
220213
},
221214
];
222215

223-
const installNode = isTruthy(checkSpecification.installNode);
216+
const installNode = checkSpecification.installNode;
224217

225218
if (installNode) {
226219
steps.push(
@@ -252,7 +245,7 @@ function main(): void {
252245
},
253246
});
254247

255-
const installGo = isTruthy(checkSpecification.installGo);
248+
const installGo = checkSpecification.installGo;
256249

257250
if (installGo) {
258251
const baseGoVersionExpr = ">=1.21.0";
@@ -276,7 +269,7 @@ function main(): void {
276269
});
277270
}
278271

279-
const installJava = isTruthy(checkSpecification.installJava);
272+
const installJava = checkSpecification.installJava;
280273

281274
if (installJava) {
282275
const baseJavaVersionExpr = "17";
@@ -298,7 +291,7 @@ function main(): void {
298291
});
299292
}
300293

301-
const installPython = isTruthy(checkSpecification.installPython);
294+
const installPython = checkSpecification.installPython;
302295

303296
if (installPython) {
304297
const basePythonVersionExpr = "3.13";
@@ -320,7 +313,7 @@ function main(): void {
320313
});
321314
}
322315

323-
const installDotNet = isTruthy(checkSpecification.installDotNet);
316+
const installDotNet = checkSpecification.installDotNet;
324317

325318
if (installDotNet) {
326319
const baseDotNetVersionExpr = "9.x";
@@ -341,7 +334,7 @@ function main(): void {
341334
});
342335
}
343336

344-
const installYq = isTruthy(checkSpecification.installYq);
337+
const installYq = checkSpecification.installYq;
345338

346339
if (installYq) {
347340
steps.push({

0 commit comments

Comments
 (0)