Skip to content

Commit

Permalink
feat: support cache custom cache id
Browse files Browse the repository at this point in the history
  • Loading branch information
jcwillox committed Dec 11, 2023
1 parent e1d10cc commit df4ec7d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
13 changes: 9 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: "Install Tool"
description: "Provide a description here"
description: "Install any tool or binary with full cache, dynamic latest version, easy to configure and has presets."

branding:
icon: "download-cloud"
color: "yellow"
Expand All @@ -10,17 +11,21 @@ inputs:
version:
description: "Version of the tool to install"
default: "latest"
id:
description: "Id to use for tool cache when not using `preset` or `repo`"
repo:
description: "Repository to use for defaults"
version_url:
description: "URL to fetch the version from"
description: "URL to fetch the latest version from"
version_path:
description: "JSON path like expression to extract version from the response"
version_regex:
description: "Regex to extract the version from the version_url"
description: "Regex to extract the version from the response"
default: "(?<version>[\\d.]+)"
download_url:
description: "URL to download the tool from"
download_name:
description: "Rename the downloaded file, does not work with extraction"
description: "Rename the downloaded file, does not work with archives"
bin_path:
description: "Sub-path of downloaded archive to add to PATH"
cache:
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export async function main() {

// load config
let config: Config = {
id: core.getInput("id"),
preset: core.getInput("preset"),
repo: core.getInput("repo"),
version: core.getInput("version"),
Expand Down
2 changes: 1 addition & 1 deletion src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function downloadTool(config: Config) {
if (!config.downloadUrl) throw new Error("Download URL missing");
if (!config.version) throw new Error("Version missing");

const toolName = config.preset || config.repo;
const toolName = config.preset || config.repo || config.id;
if (!toolName) {
config.cache = false;
core.warning("Tool name missing, disabling cache");
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type Config = {
id?: string;
repo?: string;
version: string;
versionUrl?: string;
Expand Down

0 comments on commit df4ec7d

Please sign in to comment.