Skip to content

Commit

Permalink
fix: Fixed issue with prompted variable serialization (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
slewis74 authored Jan 11, 2023
1 parent 24a9b96 commit e2116e9
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 58 deletions.
4 changes: 2 additions & 2 deletions __tests__/unit/input-parsing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
95 changes: 45 additions & 50 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -85,4 +85,4 @@
"test:integration": "jest --ci --reporters=default --reporters=jest-junit --testPathPattern=__tests__/integration"
},
"version": "3.0.0"
}
}
9 changes: 5 additions & 4 deletions src/input-parameters.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getBooleanInput, getInput, getMultilineInput } from '@actions/core'
import { PromptedVariableValues } from '@octopusdeploy/api-client'

const EnvironmentVariables = {
URL: 'OCTOPUS_URL',
Expand All @@ -20,17 +21,17 @@ export interface InputParameters {

// Optional
useGuidedFailure?: boolean
variables?: Map<string, string>
variables?: PromptedVariableValues
}

export function getInputParameters(): InputParameters {
let variablesMap: Map<string, string> | 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]
}
}

Expand Down

0 comments on commit e2116e9

Please sign in to comment.