From c926367c74d7ac64e42946f54849dfd9165e2b6f Mon Sep 17 00:00:00 2001 From: James Hegedus Date: Wed, 15 Mar 2023 10:12:23 +0000 Subject: [PATCH] feat: skip_install option to skip asdf install on setup (#536) Signed-off-by: aeddi Co-authored-by: aeddi --- install/action.yml | 4 ++++ install/main.js | 8 ++++++-- plugin-test/action.yml | 4 ++++ plugin-test/main.js | 8 ++++++-- plugins-add/action.yml | 4 ++++ plugins-add/main.js | 8 ++++++-- setup/action.yml | 4 ++++ setup/main.js | 8 ++++++-- src/setup/index.ts | 4 ++++ 9 files changed, 44 insertions(+), 8 deletions(-) diff --git a/install/action.yml b/install/action.yml index 1a86c91..78bdad6 100644 --- a/install/action.yml +++ b/install/action.yml @@ -18,3 +18,7 @@ inputs: description: asdf branch to clone required: false default: master + skip_install: + description: setup env without installing asdf + required: false + default: false diff --git a/install/main.js b/install/main.js index a45abe3..4afc292 100644 --- a/install/main.js +++ b/install/main.js @@ -2093,7 +2093,7 @@ var require_core = __commonJS({ return inputs.map((input) => input.trim()); } exports.getMultilineInput = getMultilineInput; - function getBooleanInput(name, options) { + function getBooleanInput2(name, options) { const trueValue = ["true", "True", "TRUE"]; const falseValue = ["false", "False", "FALSE"]; const val = getInput4(name, options); @@ -2104,7 +2104,7 @@ var require_core = __commonJS({ throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } - exports.getBooleanInput = getBooleanInput; + exports.getBooleanInput = getBooleanInput2; function setOutput(name, value) { const filePath = process.env["GITHUB_OUTPUT"] || ""; if (filePath) { @@ -3294,6 +3294,10 @@ async function setupAsdf() { core.exportVariable("ASDF_DATA_DIR", asdfDir); core.addPath(`${asdfDir}/bin`); core.addPath(`${asdfDir}/shims`); + const skip = core.getBooleanInput("skip_install", { required: true }); + if (skip) { + return; + } core.info(`Cloning asdf into ASDF_DIR: ${asdfDir}`); const branch = core.getInput("asdf_branch", { required: true }); await exec.exec("git", [ diff --git a/plugin-test/action.yml b/plugin-test/action.yml index cf80143..d33db29 100644 --- a/plugin-test/action.yml +++ b/plugin-test/action.yml @@ -27,6 +27,10 @@ inputs: description: asdf branch to clone required: false default: master + skip_install: + description: setup env without installing asdf + required: false + default: false github_token: description: Token used to avoid rate limit when asdf calls the GitHub API required: false diff --git a/plugin-test/main.js b/plugin-test/main.js index 0cb6c3e..618fc32 100644 --- a/plugin-test/main.js +++ b/plugin-test/main.js @@ -2093,7 +2093,7 @@ var require_core = __commonJS({ return inputs.map((input) => input.trim()); } exports.getMultilineInput = getMultilineInput; - function getBooleanInput(name, options) { + function getBooleanInput2(name, options) { const trueValue = ["true", "True", "TRUE"]; const falseValue = ["false", "False", "FALSE"]; const val = getInput3(name, options); @@ -2104,7 +2104,7 @@ var require_core = __commonJS({ throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } - exports.getBooleanInput = getBooleanInput; + exports.getBooleanInput = getBooleanInput2; function setOutput(name, value) { const filePath = process.env["GITHUB_OUTPUT"] || ""; if (filePath) { @@ -3289,6 +3289,10 @@ async function setupAsdf() { core.exportVariable("ASDF_DATA_DIR", asdfDir); core.addPath(`${asdfDir}/bin`); core.addPath(`${asdfDir}/shims`); + const skip = core.getBooleanInput("skip_install", { required: true }); + if (skip) { + return; + } core.info(`Cloning asdf into ASDF_DIR: ${asdfDir}`); const branch = core.getInput("asdf_branch", { required: true }); await exec.exec("git", [ diff --git a/plugins-add/action.yml b/plugins-add/action.yml index e066e1b..55827a6 100644 --- a/plugins-add/action.yml +++ b/plugins-add/action.yml @@ -9,6 +9,10 @@ inputs: description: asdf branch to clone required: false default: master + skip_install: + description: setup env without installing asdf + required: false + default: false tool_versions: description: If present, this value will be written to the .tool-versions file. diff --git a/plugins-add/main.js b/plugins-add/main.js index add0ddb..e7e4a19 100644 --- a/plugins-add/main.js +++ b/plugins-add/main.js @@ -2093,7 +2093,7 @@ var require_core = __commonJS({ return inputs.map((input) => input.trim()); } exports.getMultilineInput = getMultilineInput; - function getBooleanInput(name, options) { + function getBooleanInput2(name, options) { const trueValue = ["true", "True", "TRUE"]; const falseValue = ["false", "False", "FALSE"]; const val = getInput3(name, options); @@ -2104,7 +2104,7 @@ var require_core = __commonJS({ throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } - exports.getBooleanInput = getBooleanInput; + exports.getBooleanInput = getBooleanInput2; function setOutput(name, value) { const filePath = process.env["GITHUB_OUTPUT"] || ""; if (filePath) { @@ -3290,6 +3290,10 @@ async function setupAsdf() { core.exportVariable("ASDF_DATA_DIR", asdfDir); core.addPath(`${asdfDir}/bin`); core.addPath(`${asdfDir}/shims`); + const skip = core.getBooleanInput("skip_install", { required: true }); + if (skip) { + return; + } core.info(`Cloning asdf into ASDF_DIR: ${asdfDir}`); const branch = core.getInput("asdf_branch", { required: true }); await exec.exec("git", [ diff --git a/setup/action.yml b/setup/action.yml index 5588054..e0b1689 100644 --- a/setup/action.yml +++ b/setup/action.yml @@ -9,3 +9,7 @@ inputs: description: asdf branch to clone required: false default: master + skip_install: + description: setup env without installing asdf + required: false + default: false diff --git a/setup/main.js b/setup/main.js index 406f723..c60d7d6 100644 --- a/setup/main.js +++ b/setup/main.js @@ -2093,7 +2093,7 @@ var require_core = __commonJS({ return inputs.map((input) => input.trim()); } exports.getMultilineInput = getMultilineInput; - function getBooleanInput(name, options) { + function getBooleanInput2(name, options) { const trueValue = ["true", "True", "TRUE"]; const falseValue = ["false", "False", "FALSE"]; const val = getInput2(name, options); @@ -2104,7 +2104,7 @@ var require_core = __commonJS({ throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); } - exports.getBooleanInput = getBooleanInput; + exports.getBooleanInput = getBooleanInput2; function setOutput(name, value) { const filePath = process.env["GITHUB_OUTPUT"] || ""; if (filePath) { @@ -3285,6 +3285,10 @@ async function setupAsdf() { core.exportVariable("ASDF_DATA_DIR", asdfDir); core.addPath(`${asdfDir}/bin`); core.addPath(`${asdfDir}/shims`); + const skip = core.getBooleanInput("skip_install", { required: true }); + if (skip) { + return; + } core.info(`Cloning asdf into ASDF_DIR: ${asdfDir}`); const branch = core.getInput("asdf_branch", { required: true }); await exec.exec("git", [ diff --git a/src/setup/index.ts b/src/setup/index.ts index c45baf8..3f8bc22 100644 --- a/src/setup/index.ts +++ b/src/setup/index.ts @@ -14,6 +14,10 @@ export async function setupAsdf(): Promise { core.exportVariable("ASDF_DATA_DIR", asdfDir); core.addPath(`${asdfDir}/bin`); core.addPath(`${asdfDir}/shims`); + const skip = core.getBooleanInput("skip_install", { required: true }); + if (skip) { + return; + } core.info(`Cloning asdf into ASDF_DIR: ${asdfDir}`); const branch = core.getInput("asdf_branch", { required: true }); await exec.exec("git", [