From 4f326f08aa894d4b92db082ecfecb96b16e9dea9 Mon Sep 17 00:00:00 2001 From: Aiden Fujiwara Date: Tue, 3 Oct 2023 11:18:40 -0700 Subject: [PATCH] readd explicit null checks --- src/configFile.ts | 10 +++++----- src/main.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/configFile.ts b/src/configFile.ts index 4ca4cac..6b7b13d 100644 --- a/src/configFile.ts +++ b/src/configFile.ts @@ -21,24 +21,24 @@ function checkSameOrgToolSpecs( org: string ): boolean { const tools = manifestContent.tools; - if (!tools) { + if (tools == null) { throw new Error("Tools section in Foreman config not found"); } for (const tool_name in tools) { const tool_spec = tools[tool_name]; let source = tool_spec["source"]; - if (!source) { + if (source == undefined) { source = tool_spec["github"]; } - if (!source) { + if (source == undefined) { continue; } const source_array = source.split("/"); const tool_org = source_array[0]; - if (!tool_org) { + if (tool_org == null) { throw new Error( `Org not found in tool spec definition for: ${tool_name}. Foreman config is likely defined incorrectly.` ); @@ -52,7 +52,7 @@ function checkSameOrgToolSpecs( async function checkSameOrgInConfig(org: string): Promise { const manifestPath = await findUp(MANIFEST); - if (!manifestPath) { + if (manifestPath == undefined) { throw new Error("setup-foreman could not find Foreman config file"); } diff --git a/src/main.ts b/src/main.ts index e77e5d4..453abc9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -56,7 +56,7 @@ async function run(): Promise { if (allowExternalGithubOrgs != "true") { debug("Checking tools in Foreman Config come from source org"); const owner = process.env.GITHUB_REPOSITORY_OWNER; - if (!owner) { + if (owner == undefined) { throw new Error( `Could not find repository owner setup-foreman is running in` );