diff --git a/README.md b/README.md index 679f280..9aaa9d0 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ 📝 Installs [Typst] for GitHub Actions \ -⚡ Caches installation files and packages +⚡ Caches Typst installation in the tool cache \ +📦 Caches [Typst packages]() as dependencies ## Usage @@ -49,10 +50,9 @@ jobs: `0.10` or `0.x`. You can also specify `latest` to always use the latest version. The default is `latest`. -- **`packages-id`:** The identifier of a group of packages to be - cached, to distinguish between different groups of packages - and to flush the cache folder. The default is -1, which means - no caching. +- **`cache`:** Whether or not to cache any Typst packages installed during the workflow. Defaults to `true`. + +- **`cache-dependency-path`:** This should be any `.typ` file that when changed you wish to invalidate previous Typst package caches. By default it's `**/*.typ`. ### Outputs diff --git a/action.yml b/action.yml index 8afa80c..4ac9e06 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,9 @@ inputs: cache: description: Whether or not to cache any Typst packages installed during the workflow. Defaults to 'true'. default: true + cache-dependency-path: + description: This should be any '.typ' file that when changed you wish to invalidate previous Typst package caches. By default it's '**/*.typ'. + default: "**/*.typ" outputs: typst-version: diff --git a/src/main.ts b/src/main.ts index a39aed6..0fa69b1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -81,7 +81,7 @@ if (core.getBooleanInput("cache")) { darwin: () => join(process.env.HOME!, "Library/Caches", "typst/packages"), win32: () => join(process.env.LOCALAPPDATA!, "typst/packages"), }[process.platform as string]!(); - const hash = await glob.hashFiles("**/*.typ"); + const hash = await glob.hashFiles(core.getInput("cache-dependency-path")); const primaryKey = `typst-packages-cache-${process.env.RUNNER_OS}-${hash}`; core.saveState("cache-primary-key", primaryKey); core.info(`Restoring ${cacheDir} with key ${primaryKey}`);