context input

This commit is contained in:
CrazyMax
2023-03-10 01:58:55 +01:00
parent 3dcc76c352
commit e4a53ed864
6 changed files with 48 additions and 10 deletions

View File

@ -3,11 +3,13 @@ import * as core from '@actions/core';
export interface Inputs {
version: string;
channel: string;
context: string;
}
export function getInputs(): Inputs {
return {
version: core.getInput('version'),
channel: core.getInput('channel')
channel: core.getInput('channel'),
context: core.getInput('context')
};
}

View File

@ -15,10 +15,15 @@ actionsToolkit.run(
const input: context.Inputs = context.getInputs();
const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4()}`);
if (input.context == 'default') {
throw new Error(`'default' context cannot be used.`);
}
const install = new Install({
runDir: runDir,
version: input.version,
channel: input.channel
version: input.version || 'latest',
channel: input.channel || 'stable',
contextName: input.context || 'setup-docker-action'
});
let toolDir;
if (!(await Docker.isAvailable()) || input.version) {