From 8c01d0bda1beb9cbe4c11937093fa3c0f1e15396 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Thu, 14 Sep 2023 18:09:33 +0200 Subject: [PATCH] feat: automatically configure Nix to use cache (#8) --- action.yml | 3 +++ src/stages/configure.ts | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/action.yml b/action.yml index 52018b3..610ce72 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,9 @@ inputs: token: description: "Attic authorization token" required: false + skip-use: + description: "Set to true to skip using attic cache as a substituter" + required: false runs: using: "node16" diff --git a/src/stages/configure.ts b/src/stages/configure.ts index e371287..a03eb34 100644 --- a/src/stages/configure.ts +++ b/src/stages/configure.ts @@ -9,10 +9,18 @@ export const configure = async () => { const endpoint = core.getInput("endpoint"); const cache = core.getInput("cache"); const token = core.getInput("token"); + const skipUse = core.getInput("skip-use"); core.info("Logging in to attic cache"); await exec("attic", ["login", "--set-default", cache, endpoint, token]); + if (skipUse === "true") { + core.info('Not adding attic cache to substituters as skip-use is set to true'); + } else { + core.info("Adding attic cache to substituters"); + await exec.exec('attic', ['use', cache]); + } + core.info("Collecting store paths before build"); await saveStorePaths(); } catch (e) {