Switch to version 1 images (#374)

* feat: upgrade to images of version 1 (rolling tag)

* chore: indicate what needs to move out of the input class
This commit is contained in:
Webber Takken
2022-04-03 17:59:14 +02:00
committed by GitHub
parent 1bc7130fea
commit 441be81543
17 changed files with 175 additions and 139 deletions

View File

@@ -10,6 +10,8 @@ const core = require('@actions/core');
* Input variables specified in workflows using "with" prop.
*
* Note that input is always passed as a string, even booleans.
*
* Todo: rename to UserInput and remove anything that is not direct input from the user / ci workflow
*/
class Input {
public static cliOptions;
@@ -19,6 +21,7 @@ class Input {
static get cloudRunnerTests(): boolean {
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
}
private static getInput(query) {
const coreInput = core.getInput(query);
if (Input.githubInputEnabled && coreInput && coreInput !== '') {
@@ -33,19 +36,24 @@ class Input {
? process.env[Input.ToEnvVarFormat(query)]
: '';
}
static get region(): string {
return Input.getInput('region') || 'eu-west-2';
}
static async githubRepo() {
return (
Input.getInput('GITHUB_REPOSITORY') ||
Input.getInput('GITHUB_REPO') ||
// todo - move this to some class specific for determining additional information
(await GitRepoReader.GetRemote()) ||
'game-ci/unity-builder'
);
}
static async branch() {
if (await GitRepoReader.GetBranch()) {
// todo - move this to some class specific for determining additional information
return await GitRepoReader.GetBranch();
} else if (Input.getInput(`GITHUB_REF`)) {
return Input.getInput(`GITHUB_REF`).replace('refs/', '').replace(`head/`, '');
@@ -62,9 +70,11 @@ class Input {
} else if (Input.getInput(`GitSHA`)) {
return Input.getInput(`GitSHA`);
} else if (GitRepoReader.GetSha()) {
// todo - move this to some class specific for determining additional information
return GitRepoReader.GetSha();
}
}
static get runNumber() {
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
}
@@ -89,6 +99,7 @@ class Input {
!fs.existsSync(path.join('ProjectSettings', 'ProjectVersion.txt'))
? 'test-project'
: '.';
return rawProjectPath.replace(/\/$/, '');
}
@@ -197,6 +208,7 @@ class Input {
}
static async githubToken() {
// Todo - move GitHubCLI out of the simple input class. It is in fact not input from the user.
return Input.getInput('githubToken') || (await GithubCliReader.GetGitHubAuthToken()) || '';
}