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

View File

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

View File

@ -26,7 +26,6 @@ describe('Cloud Runner', () => {
}; };
if (Input.cloudRunnerTests) { if (Input.cloudRunnerTests) {
it('All build parameters sent to cloud runner as env vars', async () => { it('All build parameters sent to cloud runner as env vars', async () => {
Input.githubEnabled = false;
const buildParameter = await BuildParameters.create(); const buildParameter = await BuildParameters.create();
const baseImage = new ImageTag(buildParameter); const baseImage = new ImageTag(buildParameter);
const file = await CloudRunner.run(buildParameter, baseImage.toString()); 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. * Note that input is always passed as a string, even booleans.
*/ */
class Input { class Input {
public static githubEnabled = true;
public static cliOptions; public static cliOptions;
static get cloudRunnerTests(): boolean { static get cloudRunnerTests(): boolean {
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false; return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
} }
private static getInput(query) { private static getInput(query) {
return Input.githubEnabled const coreInput = core.getInput(query);
? core.getInput(query) return coreInput
? coreInput
: Input.cliOptions !== undefined && Input.cliOptions[query] !== undefined : Input.cliOptions !== undefined && Input.cliOptions[query] !== undefined
? Input.cliOptions[query] ? Input.cliOptions[query]
: process.env[query] !== undefined : process.env[query] !== undefined
? process.env[query] ? process.env[query]
: process.env[Input.ToEnvVarFormat(query)] : process.env[Input.ToEnvVarFormat(query)]
? process.env[Input.ToEnvVarFormat(query)] ? process.env[Input.ToEnvVarFormat(query)]
: false; : '';
} }
static get region(): string { static get region(): string {
return Input.getInput('region') || 'eu-west-2'; return Input.getInput('region') || 'eu-west-2';