Sync input with documentation (#155)

pull/156/head
David Finol 2022-01-01 14:38:47 -06:00 committed by GitHub
parent f61055d56f
commit 8a69fc6be3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 23 deletions

View File

@ -13,6 +13,9 @@ inputs:
projectPath: projectPath:
required: false required: false
description: 'Path to the Unity project to be tested.' description: 'Path to the Unity project to be tested.'
customParameters:
required: false
description: 'Extra parameters to configure the Unity editor run.'
testMode: testMode:
required: false required: false
default: 'all' default: 'all'
@ -24,19 +27,15 @@ inputs:
useHostNetwork: useHostNetwork:
required: false required: false
default: false default: false
description: 'Initialises Docker using the hosts network.' description: 'Initialises Docker using the host network.'
customParameters:
required: false
description: 'Extra parameters to configure the Unity editor run.'
sshAgent: sshAgent:
required: false required: false
default: '' default: ''
description: 'SSH Agent path to forward to the container' description: 'SSH Agent path to forward to the container.'
gitPrivateToken: gitPrivateToken:
required: false required: false
default: '' default: ''
description: > description: 'GitHub Private Access Token (PAT) to pull from GitHub.'
Github private token to pull from github
githubToken: githubToken:
required: false required: false
default: '' default: ''

File diff suppressed because one or more lines are too long

View File

@ -9,11 +9,12 @@ async function action() {
unityVersion, unityVersion,
customImage, customImage,
projectPath, projectPath,
customParameters,
testMode, testMode,
artifactsPath, artifactsPath,
useHostNetwork, useHostNetwork,
customParameters,
sshAgent, sshAgent,
gitPrivateToken,
githubToken, githubToken,
checkName, checkName,
} = Input.getFromUser(); } = Input.getFromUser();
@ -25,14 +26,15 @@ async function action() {
// Run docker image // Run docker image
await Docker.run(actionImage, { await Docker.run(actionImage, {
workspace,
unityVersion, unityVersion,
workspace,
projectPath, projectPath,
customParameters,
testMode, testMode,
artifactsPath, artifactsPath,
useHostNetwork, useHostNetwork,
customParameters,
sshAgent, sshAgent,
gitPrivateToken,
githubToken, githubToken,
}); });
} finally { } finally {

View File

@ -22,13 +22,13 @@ class Docker {
unityVersion, unityVersion,
workspace, workspace,
projectPath, projectPath,
customParameters,
testMode, testMode,
artifactsPath, artifactsPath,
useHostNetwork, useHostNetwork,
customParameters,
sshAgent, sshAgent,
githubToken,
gitPrivateToken, gitPrivateToken,
githubToken,
} = parameters; } = parameters;
const command = `docker run \ const command = `docker run \
@ -41,9 +41,9 @@ class Docker {
--env UNITY_SERIAL \ --env UNITY_SERIAL \
--env UNITY_VERSION="${unityVersion}" \ --env UNITY_VERSION="${unityVersion}" \
--env PROJECT_PATH="${projectPath}" \ --env PROJECT_PATH="${projectPath}" \
--env CUSTOM_PARAMETERS="${customParameters}" \
--env TEST_MODE="${testMode}" \ --env TEST_MODE="${testMode}" \
--env ARTIFACTS_PATH="${artifactsPath}" \ --env ARTIFACTS_PATH="${artifactsPath}" \
--env CUSTOM_PARAMETERS="${customParameters}" \
--env GITHUB_REF \ --env GITHUB_REF \
--env GITHUB_SHA \ --env GITHUB_SHA \
--env GITHUB_REPOSITORY \ --env GITHUB_REPOSITORY \

View File

@ -17,29 +17,29 @@ class Input {
// Input variables specified in workflow using "with" prop. // Input variables specified in workflow using "with" prop.
const rawUnityVersion = getInput('unityVersion') || 'auto'; const rawUnityVersion = getInput('unityVersion') || 'auto';
const customImage = getInput('customImage') || ''; const customImage = getInput('customImage') || '';
const testMode = (getInput('testMode') || 'all').toLowerCase();
const rawProjectPath = getInput('projectPath') || '.'; const rawProjectPath = getInput('projectPath') || '.';
const customParameters = getInput('customParameters') || '';
const testMode = (getInput('testMode') || 'all').toLowerCase();
const rawArtifactsPath = getInput('artifactsPath') || 'artifacts'; const rawArtifactsPath = getInput('artifactsPath') || 'artifacts';
const rawUseHostNetwork = getInput('useHostNetwork') || 'false'; const rawUseHostNetwork = getInput('useHostNetwork') || 'false';
const customParameters = getInput('customParameters') || '';
const sshAgent = getInput('sshAgent') || ''; const sshAgent = getInput('sshAgent') || '';
const gitPrivateToken = getInput('gitPrivateToken') || '';
const githubToken = getInput('githubToken') || ''; const githubToken = getInput('githubToken') || '';
const checkName = getInput('checkName') || 'Test Results'; const checkName = getInput('checkName') || 'Test Results';
const gitPrivateToken = getInput('gitPrivateToken') || '';
// Validate input // Validate input
if (!includes(this.testModes, testMode)) { if (!includes(this.testModes, testMode)) {
throw new Error(`Invalid testMode ${testMode}`); throw new Error(`Invalid testMode ${testMode}`);
} }
if (!this.isValidFolderName(rawArtifactsPath)) {
throw new Error(`Invalid artifactsPath "${rawArtifactsPath}"`);
}
if (!this.isValidFolderName(rawProjectPath)) { if (!this.isValidFolderName(rawProjectPath)) {
throw new Error(`Invalid projectPath "${rawProjectPath}"`); throw new Error(`Invalid projectPath "${rawProjectPath}"`);
} }
if (!this.isValidFolderName(rawArtifactsPath)) {
throw new Error(`Invalid artifactsPath "${rawArtifactsPath}"`);
}
if (rawUseHostNetwork !== 'true' && rawUseHostNetwork !== 'false') { if (rawUseHostNetwork !== 'true' && rawUseHostNetwork !== 'false') {
throw new Error(`Invalid useHostNetwork "${rawUseHostNetwork}"`); throw new Error(`Invalid useHostNetwork "${rawUseHostNetwork}"`);
} }
@ -56,14 +56,14 @@ class Input {
unityVersion, unityVersion,
customImage, customImage,
projectPath, projectPath,
customParameters,
testMode, testMode,
artifactsPath, artifactsPath,
useHostNetwork, useHostNetwork,
customParameters,
sshAgent, sshAgent,
gitPrivateToken,
githubToken, githubToken,
checkName, checkName,
gitPrivateToken,
}; };
} }
} }