Skip to content

Commit

Permalink
fix(space issue): this should resolve the issue with using a blank sp…
Browse files Browse the repository at this point in the history
…ace. the assumption here is that 'json' is default, if you use ' ' it will be '' which is the app default, not the action default of 'json'

I don't specifically like the solution in #81 of having a string that represents something.  Not that many people will need the string 'space' over the string ' ' but this is just logical preference for WYSIWYG.
  • Loading branch information
trilom committed Mar 24, 2020
1 parent 800537f commit 0e4184f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 4 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ inputs:
required: false
output:
description: 'Choose between json (default), or custom delimiter by passing a string, for example '','' for csv variable output'
required: false
required: true
default: json
fileOutput:
description: 'Choose between json (default), or custom delimiter by passing a string, for example '','' for csv file output. If you set as json the file output will be suffixed with .json, if you select '','' then the output will be .csv, else .txt will be the output.'
required: false
required: true
default: json
outputs:
files:
description: 'The names all new, updated, and removed files'
Expand Down
4 changes: 2 additions & 2 deletions src/InputHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export function getInputs(): Inputs {
(typeof context.issue.number === 'undefined'
? NaN
: context.issue.number),
output: coreGetInput('output') || 'json',
fileOutput: coreGetInput('fileOutput') || 'json',
output: coreGetInput('output') || ' ',
fileOutput: coreGetInput('fileOutput') || ' ',
event: context.eventName
} as Inputs
} catch (error) {
Expand Down
14 changes: 7 additions & 7 deletions src/tests/InputHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ describe('Testing InputHelper.ts...', () => {
}
expect(githubToken).toBe(process.env.INPUT_GITHUBTOKEN)
expect(githubRepo).toBe(process.env.GITHUB_REPOSITORY)
expect(output).toBe('json')
expect(fileOutput).toBe('json')
expect(output).toBe(' ')
expect(fileOutput).toBe(' ')
expect(inputEventName).toBe(contextEventName)
expect(getInput).toHaveBeenCalledTimes(7)
expect(getInput).toHaveBeenCalled()
})
it('...throws error with no token (undefined) process.env["GITHUB_TOKEN"] or (undefined) input githubToken', () => {
delete process.env.GITHUB_TOKEN
Expand Down Expand Up @@ -95,7 +95,7 @@ describe('Testing InputHelper.ts...', () => {
)
}
if (
event.includes('pull_request') ||
event.includes('pull_request')||
event.includes('issue_comment')
) {
expect(prNumber).toBe(
Expand Down Expand Up @@ -125,12 +125,12 @@ describe('Testing InputHelper.ts...', () => {
? expected
: process.env.GITHUB_REPOSITORY
)
expect(output).toBe(inputName === 'output' ? expected : 'json')
expect(output).toBe(inputName === 'output' ? expected : ' ')
expect(fileOutput).toBe(
inputName === 'fileOutput' ? expected : 'json'
inputName === 'fileOutput' ? expected : ' '
)
expect(inputEventName).toBe(contextEventName)
expect(getInput).toHaveBeenCalledTimes(7)
expect(getInput).toBeCalled()
}
)
})
Expand Down

0 comments on commit 0e4184f

Please sign in to comment.