From e2116e9989820fe263e8481da9ffeb0dcb8c2bf1 Mon Sep 17 00:00:00 2001 From: Shannon Lewis Date: Wed, 11 Jan 2023 13:03:47 +1000 Subject: [PATCH] fix: Fixed issue with prompted variable serialization (#8) --- __tests__/unit/input-parsing.test.ts | 4 +- package-lock.json | 95 +++++++++++++--------------- package.json | 4 +- src/input-parameters.ts | 9 +-- 4 files changed, 54 insertions(+), 58 deletions(-) diff --git a/__tests__/unit/input-parsing.test.ts b/__tests__/unit/input-parsing.test.ts index 0dbc8a42..3026358b 100644 --- a/__tests__/unit/input-parsing.test.ts +++ b/__tests__/unit/input-parsing.test.ts @@ -7,6 +7,6 @@ test('get input parameters', () => { expect(inputParameters.environments[0]).toBe('Dev') expect(inputParameters.environments[1]).toBe('Staging') expect(inputParameters.variables).toBeDefined() - expect(inputParameters.variables?.get('foo')).toBe('quux') - expect(inputParameters.variables?.get('bar')).toBe('xyzzy') + expect(inputParameters.variables?.['foo']).toBe('quux') + expect(inputParameters.variables?.['bar']).toBe('xyzzy') }) diff --git a/package-lock.json b/package-lock.json index 0b05445d..1a405cca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,14 +5,12 @@ "requires": true, "packages": { "": { - "name": "deploy-release-untenanted-action", - "version": "3.0.0", "name": "deploy-release-action", "version": "3.0.0", "license": "Apache-2.0", "dependencies": { "@actions/core": "^1.10.0", - "@octopusdeploy/api-client": "^2.1.1" + "@octopusdeploy/api-client": "^2.1.4" }, "devDependencies": { "@octopusdeploy/runtime-inputs": "^0.16.0", @@ -1240,17 +1238,16 @@ } }, "node_modules/@octopusdeploy/api-client": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.1.1.tgz", - "integrity": "sha512-4ZjWt/tdN8wRl2OG2rjp+AtdA6dIYGYv/CrgTISOWsUB5XybpKhP/BNhV2H5GDMzt/LwkZGa727kBJA8CFr74A==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.1.4.tgz", + "integrity": "sha512-ySaVkFouE4sfDpcjJyTBVnPE4BZ6540hH8glfTydzp1B+jjA5q6kIDbk+fu35h2ZRcOu0hAKfIPcLlntpqSnFg==", "dependencies": { "adm-zip": "^0.5.9", - "axios": "^0.27.2", + "axios": "^1.2.1", "form-data": "^4.0.0", "glob": "^8.0.3", - "hpagent": "^1.0.0", "lodash": "^4.17.21", - "semver": "^7.3.7", + "semver": "^7.3.8", "urijs": "^1.19.11" } }, @@ -1763,9 +1760,9 @@ } }, "node_modules/adm-zip": { - "version": "0.5.9", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.9.tgz", - "integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==", + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz", + "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==", "engines": { "node": ">=6.0" } @@ -1936,12 +1933,13 @@ } }, "node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz", + "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==", "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/axobject-query": { @@ -3384,9 +3382,9 @@ } }, "node_modules/glob/node_modules/minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -3510,14 +3508,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/hpagent": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", - "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==", - "engines": { - "node": ">=14" - } - }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -5294,6 +5284,11 @@ "node": ">= 6" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", @@ -7152,17 +7147,16 @@ } }, "@octopusdeploy/api-client": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.1.1.tgz", - "integrity": "sha512-4ZjWt/tdN8wRl2OG2rjp+AtdA6dIYGYv/CrgTISOWsUB5XybpKhP/BNhV2H5GDMzt/LwkZGa727kBJA8CFr74A==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@octopusdeploy/api-client/-/api-client-2.1.4.tgz", + "integrity": "sha512-ySaVkFouE4sfDpcjJyTBVnPE4BZ6540hH8glfTydzp1B+jjA5q6kIDbk+fu35h2ZRcOu0hAKfIPcLlntpqSnFg==", "requires": { "adm-zip": "^0.5.9", - "axios": "^0.27.2", + "axios": "^1.2.1", "form-data": "^4.0.0", "glob": "^8.0.3", - "hpagent": "^1.0.0", "lodash": "^4.17.21", - "semver": "^7.3.7", + "semver": "^7.3.8", "urijs": "^1.19.11" } }, @@ -7537,9 +7531,9 @@ "requires": {} }, "adm-zip": { - "version": "0.5.9", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.9.tgz", - "integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==" + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz", + "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==" }, "ajv": { "version": "6.12.6", @@ -7660,12 +7654,13 @@ "dev": true }, "axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz", + "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==", "requires": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "axobject-query": { @@ -8718,9 +8713,9 @@ } }, "minimatch": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.1.tgz", - "integrity": "sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", "requires": { "brace-expansion": "^2.0.1" } @@ -8816,11 +8811,6 @@ "has-symbols": "^1.0.2" } }, - "hpagent": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", - "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==" - }, "html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -10141,6 +10131,11 @@ "sisteransi": "^1.0.5" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", diff --git a/package.json b/package.json index 21c4c2f3..902bb068 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ }, "dependencies": { "@actions/core": "^1.10.0", - "@octopusdeploy/api-client": "^2.1.1" + "@octopusdeploy/api-client": "^2.1.4" }, "description": "GitHub Action to Create a Release in Octopus Deploy", "devDependencies": { @@ -85,4 +85,4 @@ "test:integration": "jest --ci --reporters=default --reporters=jest-junit --testPathPattern=__tests__/integration" }, "version": "3.0.0" -} \ No newline at end of file +} diff --git a/src/input-parameters.ts b/src/input-parameters.ts index 750644f8..e5b08c62 100644 --- a/src/input-parameters.ts +++ b/src/input-parameters.ts @@ -1,4 +1,5 @@ import { getBooleanInput, getInput, getMultilineInput } from '@actions/core' +import { PromptedVariableValues } from '@octopusdeploy/api-client' const EnvironmentVariables = { URL: 'OCTOPUS_URL', @@ -20,17 +21,17 @@ export interface InputParameters { // Optional useGuidedFailure?: boolean - variables?: Map + variables?: PromptedVariableValues } export function getInputParameters(): InputParameters { - let variablesMap: Map | undefined = undefined + let variablesMap: PromptedVariableValues | undefined = undefined const variables = getMultilineInput('variables').map(p => p.trim()) || undefined if (variables) { - variablesMap = new Map() + variablesMap = {} for (const variable of variables) { const variableMap = variable.split(':').map(x => x.trim()) - variablesMap?.set(variableMap[0], variableMap[1]) + variablesMap[variableMap[0]] = variableMap[1] } }