Add optional argument to action

This commit is contained in:
Daniel Lupiañez Casares
2026-04-17 19:20:37 +02:00
committed by frostebite
parent 2321712bb4
commit a12e3e829e
3 changed files with 12 additions and 2 deletions

View File

@@ -47,6 +47,10 @@ inputs:
required: false
default: ''
description: 'Custom parameters to configure the build.'
useHostNetwork:
required: false
default: false
description: 'Initialises Docker using the host network. (Linux only)'
versioning:
required: false
default: 'Semantic'

8
dist/index.js generated vendored
View File

@@ -327,6 +327,7 @@ class BuildParameters {
androidExportType: input_1.default.androidExportType,
androidSymbolType: androidSymbolExportType,
customParameters: input_1.default.customParameters,
useHostNetwork: input_1.default.useHostNetwork,
sshAgent: input_1.default.sshAgent,
sshPublicKeysDirectoryPath: input_1.default.sshPublicKeysDirectoryPath,
gitPrivateToken: input_1.default.gitPrivateToken ?? (await github_cli_1.GithubCliReader.GetGitHubAuthToken()),
@@ -637,7 +638,7 @@ class Docker {
return await (0, exec_1.exec)(runCommand, undefined, options);
}
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
const { workspace, actionFolder, runnerTempPath, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, dockerWorkspacePath, dockerCpuLimit, dockerMemoryLimit, } = parameters;
const { workspace, actionFolder, useHostNetwork, runnerTempPath, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, dockerWorkspacePath, dockerCpuLimit, dockerMemoryLimit, } = parameters;
const githubHome = node_path_1.default.join(runnerTempPath, '_github_home');
if (!(0, node_fs_1.existsSync)(githubHome))
(0, node_fs_1.mkdirSync)(githubHome);
@@ -670,6 +671,7 @@ class Docker {
? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro'
: ''} \
${sshPublicKeysDirectoryPath ? `--volume ${sshPublicKeysDirectoryPath}:/root/.ssh:ro` : ''} \
${useHostNetwork ? '--net=host' : ''} \
${entrypointBash ? `--entrypoint ${commandPrefix}` : ``} \
${image} \
${entrypointBash ? `-c` : `${commandPrefix} -c`} \
@@ -1382,6 +1384,10 @@ class Input {
static get customParameters() {
return Input.getInput('customParameters') ?? '';
}
static get useHostNetwork() {
const input = Input.getInput('useHostNetwork') ?? false;
return input === 'true';
}
static get versioningStrategy() {
return Input.getInput('versioning') ?? 'Semantic';
}

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long