diff --git a/action.yml b/action.yml index aa4a706f..a0df28d8 100644 --- a/action.yml +++ b/action.yml @@ -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' diff --git a/src/InputHelper.ts b/src/InputHelper.ts index 774c94d3..4413f162 100644 --- a/src/InputHelper.ts +++ b/src/InputHelper.ts @@ -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) { diff --git a/src/tests/InputHelper.test.ts b/src/tests/InputHelper.test.ts index 1c187c40..c00965fc 100644 --- a/src/tests/InputHelper.test.ts +++ b/src/tests/InputHelper.test.ts @@ -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 @@ -95,7 +95,7 @@ describe('Testing InputHelper.ts...', () => { ) } if ( - event.includes('pull_request') || + event.includes('pull_request')|| event.includes('issue_comment') ) { expect(prNumber).toBe( @@ -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() } ) })