Use boolean

This commit is contained in:
Toby Harris 2023-09-20 13:05:15 +01:00
parent 3e4f343b07
commit aab7c4f710
6 changed files with 16 additions and 9 deletions

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View File

@ -119,7 +119,7 @@ echo ""
unity-editor \ unity-editor \
-logfile /dev/stdout \ -logfile /dev/stdout \
$( [ -n "${MANUAL_EXIT+set}" ] || echo "-quit" ) \ $( [ "${MANUAL_EXIT}" == "true" ] || echo "-quit" ) \
-customBuildName "$BUILD_NAME" \ -customBuildName "$BUILD_NAME" \
-projectPath "$UNITY_PROJECT_PATH" \ -projectPath "$UNITY_PROJECT_PATH" \
-buildTarget "$BUILD_TARGET" \ -buildTarget "$BUILD_TARGET" \

View File

@ -29,7 +29,7 @@ class BuildParameters {
public buildFile!: string; public buildFile!: string;
public buildMethod!: string; public buildMethod!: string;
public buildVersion!: string; public buildVersion!: string;
public manualExit!: string | undefined; public manualExit!: boolean;
public androidVersionCode!: string; public androidVersionCode!: string;
public androidKeystoreName!: string; public androidKeystoreName!: string;
public androidKeystoreBase64!: string; public androidKeystoreBase64!: string;

View File

@ -106,13 +106,18 @@ describe('Input', () => {
describe('manualExit', () => { describe('manualExit', () => {
it('returns the default value', () => { it('returns the default value', () => {
expect(Input.manualExit).toStrictEqual(undefined); expect(Input.manualExit).toStrictEqual(false);
}); });
it('takes input from the users workflow', () => { it('returns true when string true is passed', () => {
const mockValue = 'x'; const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); expect(Input.manualExit).toStrictEqual(true);
expect(Input.manualExit).toStrictEqual(mockValue); expect(spy).toHaveBeenCalledTimes(1);
});
it('returns false when string false is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
expect(Input.manualExit).toStrictEqual(false);
expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledTimes(1);
}); });
}); });

View File

@ -126,8 +126,10 @@ class Input {
return Input.getInput('buildMethod') || ''; // Processed in docker file return Input.getInput('buildMethod') || ''; // Processed in docker file
} }
static get manualExit(): string | undefined { static get manualExit(): boolean {
return Input.getInput('manualExit'); const input = Input.getInput('manualExit') || false;
return input === 'true';
} }
static get customParameters(): string { static get customParameters(): string {