From 5e6436af6b07cf6d674236d40e456a22a0ca5247 Mon Sep 17 00:00:00 2001 From: Shi Chen Date: Wed, 23 Oct 2024 15:07:48 -0500 Subject: [PATCH] feat: Added support for the input `module` as an aliase for `modules`. #5 --- README.md | 3 +++ action.yml | 6 ++++-- src/index.ts | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1e66e87..060e9c8 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,9 @@ This action allows you to set up the [Igor executable](https://manual.gamemaker. # A comma separated string for the modules to install # Optional. Default is 'windows' for windows runner, 'android' for Linux runner, and "ios" for MacOS runner modules: + + #Aliased version of `modules`. + module: ``` ### Outputs diff --git a/action.yml b/action.yml index 5a60ab0..4d8ff3f 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,8 @@ inputs: description: "Path to a file to overwrite the default devices.json that defines the Device Manager." modules: description: "A comma separated string for the modules to install." + module: + description: "Aliased version of `modules`." outputs: runtime-dir: description: "The directory containing the installed runtime." @@ -29,8 +31,8 @@ outputs: bootstrapper-dir: description: "The directory containing the Igor bootstrapper. Useful for caching." branding: - icon: 'gift' - color: 'green' + icon: "gift" + color: "green" runs: using: "node20" main: "dist/index.js" diff --git a/src/index.ts b/src/index.ts index b213659..2bd1ace 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,8 +20,18 @@ export async function run() { "local-settings-override-file" ); const devicesOverrideFile = core.getInput("devices-settings-override-file"); - const targetModules = core.getInput("modules") - ? core.getInput("modules").split(",") + + const targetModulesFromInputModule = core.getInput("module"); + const targetModulesFromInputModules = core.getInput("modules"); + if (targetModulesFromInputModule && targetModulesFromInputModules) { + throw new Error( + "Both `module` and `modules` are specified. You must specify only one." + ); + } + const targetModules = + targetModulesFromInputModule || targetModulesFromInputModules; + const targetModulesSplitAsArray = targetModules + ? targetModules.split(",") : undefined; const igorSetup = new IgorSetup( @@ -31,7 +41,7 @@ export async function run() { devicesOverrideFile ); await igorSetup.ensureIgorBootStrapperBasedOnOs(); - igorSetup.installModules(targetModules); + igorSetup.installModules(targetModulesSplitAsArray); core.info(`Installed modules: ${igorSetup.targetModules.join(",")}`); core.info(`For runtime: ${targetRuntime}`); core.setOutput("cache-dir", igorSetup.cacheDir);