From d09ac443474a6502af5edb77e064325ce63b50ec Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Mon, 11 Nov 2024 17:18:38 +0100 Subject: [PATCH] fix(workflows): Copy rootSrc to check gloPatterns correctly --- default.nix | 10 ++++++++-- modules/workflows.nix | 10 +++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index bd90606..a1da823 100644 --- a/default.nix +++ b/default.nix @@ -6,6 +6,8 @@ let inherit (pkgs) lib mkShell; + inherit (pkgs.lib.fileset) gitTracked toSource; + git-checks = (import sources.git-hooks).run { src = ./.; @@ -39,14 +41,18 @@ in }; install = - config: + { src, ... }@config: let project = lib.evalModules { modules = [ ./modules { - config = config // { + config = (removeAttrs config [ "src" ]) // { _module.args.pkgs = pkgs; + rootSrc = toSource { + root = src; + fileset = gitTracked src; + }; }; } ]; diff --git a/modules/workflows.nix b/modules/workflows.nix index 481795a..ef90a30 100644 --- a/modules/workflows.nix +++ b/modules/workflows.nix @@ -21,6 +21,7 @@ let attrsOf bool enum + path str ; @@ -49,7 +50,7 @@ let json2yaml "$valuePath" "$out" # Check that the workflow is valid - action-validator "$out" + cd "${cfg.rootSrc}" && action-validator "$out" '' ) { }; @@ -104,6 +105,13 @@ in Whether to remove unknown workflow files. ''; }; + + rootSrc = mkOption { + type = path; + description = '' + The source of the project. + ''; + }; }; config = {