Skip to content

Commit

Permalink
feat: Added support for the input module as an aliase for modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
shichen85 committed Oct 23, 2024
1 parent 52008bb commit 5e6436a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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"
16 changes: 13 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
Expand Down

0 comments on commit 5e6436a

Please sign in to comment.