From ab062435f90bc91cec1849b0028452826abbb141 Mon Sep 17 00:00:00 2001 From: Zainuden Veetikadam Date: Tue, 8 Dec 2020 14:49:48 +0530 Subject: [PATCH] changes from arary to set --- lib/main.js | 4 ++-- src/main.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 4be73f59..bf4b8b03 100644 --- a/lib/main.js +++ b/lib/main.js @@ -50,7 +50,7 @@ function main() { core.exportVariable('AZUREPS_HOST_ENVIRONMENT', azurePSHostEnv); azPath = yield io.which("az", true); yield executeAzCliCommand("--version"); - let azureSupportedCloudName = ["azureusgovernment", "azurechinacloud", "azuregermancloud", "azurecloud", "azurestack"]; + let azureSupportedCloudName = new Set(["azureusgovernment", "azurechinacloud", "azuregermancloud", "azurecloud", "azurestack"]); let creds = core.getInput('creds', { required: true }); let secrets = new actions_secret_parser_1.SecretParser(creds, actions_secret_parser_1.FormatType.JSON); let servicePrincipalId = secrets.getSecret("$.clientId", false); @@ -64,7 +64,7 @@ function main() { if (!servicePrincipalId || !servicePrincipalKey || !tenantId || !subscriptionId) { throw new Error("Not all values are present in the creds object. Ensure clientId, clientSecret, tenantId and subscriptionId are supplied."); } - if (!azureSupportedCloudName.includes(environment)) { + if (!azureSupportedCloudName.has(environment)) { throw new Error("Unsupported value for environment is passed.The list of supported values for environment are ‘azureusgovernment', ‘azurechinacloud’, ‘azuregermancloud’, ‘azurecloud’ or ’azurestack’"); } // Attempting Az cli login diff --git a/src/main.ts b/src/main.ts index 0fd469b9..e31e9854 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,7 +23,7 @@ async function main() { azPath = await io.which("az", true); await executeAzCliCommand("--version"); - let azureSupportedCloudName:string[] = ["azureusgovernment", "azurechinacloud", "azuregermancloud","azurecloud","azurestack"]; + let azureSupportedCloudName = new Set(["azureusgovernment", "azurechinacloud", "azuregermancloud","azurecloud","azurestack"]); let creds = core.getInput('creds', { required: true }); let secrets = new SecretParser(creds, FormatType.JSON); let servicePrincipalId = secrets.getSecret("$.clientId", false); @@ -39,7 +39,7 @@ async function main() { throw new Error("Not all values are present in the creds object. Ensure clientId, clientSecret, tenantId and subscriptionId are supplied."); } - if(!azureSupportedCloudName.includes(environment)){ + if(!azureSupportedCloudName.has(environment)){ throw new Error("Unsupported value for environment is passed.The list of supported values for environment are ‘azureusgovernment', ‘azurechinacloud’, ‘azuregermancloud’, ‘azurecloud’ or ’azurestack’"); }