mirror of
https://github.com/docker/setup-docker-action.git
synced 2025-12-31 09:31:28 +01:00
move runtime-basedir default to context
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import * as core from '@actions/core';
|
||||
import {parse} from 'csv-parse/sync';
|
||||
|
||||
@@ -11,7 +13,7 @@ export interface Inputs {
|
||||
context: string;
|
||||
setHost: boolean;
|
||||
rootless: boolean;
|
||||
runtimeBasedir?: string;
|
||||
runtimeBasedir: string;
|
||||
}
|
||||
|
||||
export function getInputs(): Inputs {
|
||||
@@ -29,7 +31,7 @@ export function getInputs(): Inputs {
|
||||
context: core.getInput('context'),
|
||||
setHost: core.getBooleanInput('set-host'),
|
||||
rootless: core.getBooleanInput('rootless'),
|
||||
runtimeBasedir: core.getInput('runtime-basedir')
|
||||
runtimeBasedir: core.getInput('runtime-basedir') || path.join(os.homedir(), `setup-docker-action`)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import * as crypto from 'crypto';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import * as core from '@actions/core';
|
||||
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||
@@ -18,8 +17,7 @@ actionsToolkit.run(
|
||||
// main
|
||||
async () => {
|
||||
const input: context.Inputs = context.getInputs();
|
||||
const runBasedir = input.runtimeBasedir || path.join(os.homedir(), `setup-docker-action`);
|
||||
const runDir = path.join(runBasedir, `run-${crypto.randomUUID().slice(0, 8)}`);
|
||||
const runDir = path.join(input.runtimeBasedir, `run-${crypto.randomUUID().slice(0, 8)}`);
|
||||
|
||||
if (input.context == 'default') {
|
||||
throw new Error(`'default' context cannot be used.`);
|
||||
|
||||
Reference in New Issue
Block a user