pull/310/head
Frostebite 2021-12-31 06:11:00 +00:00
parent 08edeacb31
commit 8720fbad32
6 changed files with 10 additions and 15 deletions

10
dist/index.js vendored
View File

@ -78,7 +78,6 @@ if (cli_1.CLI.isCliMode(options)) {
cli_1.CLI.RunCli(options);
}
else {
model_1.Input.githubEnabled = true;
runMain();
}
@ -419,7 +418,6 @@ class CLI {
return options.mode !== undefined && options.mode !== '';
}
static SetupCli() {
__1.Input.githubEnabled = false;
const program = new commander_ts_1.Command();
program.version('0.0.1');
const properties = Object.getOwnPropertyNames(__1.Input);
@ -3473,15 +3471,16 @@ class Input {
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
}
static getInput(query) {
return Input.githubEnabled
? core.getInput(query)
const coreInput = core.getInput(query);
return coreInput
? coreInput
: Input.cliOptions !== undefined && Input.cliOptions[query] !== undefined
? Input.cliOptions[query]
: process.env[query] !== undefined
? process.env[query]
: process.env[Input.ToEnvVarFormat(query)]
? process.env[Input.ToEnvVarFormat(query)]
: false;
: '';
}
static get region() {
return Input.getInput('region') || 'eu-west-2';
@ -3639,7 +3638,6 @@ class Input {
.replace(/ /g, '_');
}
}
Input.githubEnabled = true;
exports.default = Input;

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
import * as core from '@actions/core';
import { Action, BuildParameters, Cache, Docker, ImageTag, Output, CloudRunner, Input } from './model';
import { Action, BuildParameters, Cache, Docker, ImageTag, Output, CloudRunner } from './model';
import { CLI } from './model/cli/cli';
async function runMain() {
try {
@ -33,6 +33,5 @@ const options = CLI.SetupCli();
if (CLI.isCliMode(options)) {
CLI.RunCli(options);
} else {
Input.githubEnabled = true;
runMain();
}

View File

@ -38,7 +38,6 @@ export class CLI {
}
public static SetupCli() {
Input.githubEnabled = false;
const program = new Command();
program.version('0.0.1');
const properties = Object.getOwnPropertyNames(Input);

View File

@ -26,7 +26,6 @@ describe('Cloud Runner', () => {
};
if (Input.cloudRunnerTests) {
it('All build parameters sent to cloud runner as env vars', async () => {
Input.githubEnabled = false;
const buildParameter = await BuildParameters.create();
const baseImage = new ImageTag(buildParameter);
const file = await CloudRunner.run(buildParameter, baseImage.toString());

View File

@ -12,21 +12,21 @@ const core = require('@actions/core');
* Note that input is always passed as a string, even booleans.
*/
class Input {
public static githubEnabled = true;
public static cliOptions;
static get cloudRunnerTests(): boolean {
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
}
private static getInput(query) {
return Input.githubEnabled
? core.getInput(query)
const coreInput = core.getInput(query);
return coreInput
? coreInput
: Input.cliOptions !== undefined && Input.cliOptions[query] !== undefined
? Input.cliOptions[query]
: process.env[query] !== undefined
? process.env[query]
: process.env[Input.ToEnvVarFormat(query)]
? process.env[Input.ToEnvVarFormat(query)]
: false;
: '';
}
static get region(): string {
return Input.getInput('region') || 'eu-west-2';