From 07ce189ed7f6b48c9fcdf054cac87da79c2eada4 Mon Sep 17 00:00:00 2001 From: Aidan Reilly Date: Thu, 16 Jul 2026 18:21:57 +0100 Subject: [PATCH] fix: allow action scripts to be found inside the style directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `suggest` action's script resolution only checked `config/actions/` for .tengo files. This forced package authors to ship action scripts in a separate `config/` directory, but `vale sync` drops sibling directories for style-only packages — it only copies the folder matching the package name (e.g., `RedHat/`). This created an impossible packaging constraint: the script had to be in `config/actions/` for the action to find it, but that directory was silently dropped during sync because it sat outside the style folder. Add a fallback so the `suggest` action also searches the style's own directory (e.g., `/RedHat/NoGerundsInTitles.tengo`). This mirrors how dictionaries work — they live inside the style folder and are referenced via a relative path. The lookup order is: `config/actions/` first (backwards compatible), then `//`. Co-Authored-By: Claude Opus 4.6 rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED --- internal/check/action.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/check/action.go b/internal/check/action.go index c619c534..3d2a50e1 100644 --- a/internal/check/action.go +++ b/internal/check/action.go @@ -78,6 +78,13 @@ func script(name string, alert core.Alert, cfg *core.Config) ([]string, error) { var suggestions = []string{} file := core.FindConfigAsset(cfg, name, core.ActionDir) + if file == "" { + // Fall back to the style's own directory. + parts := strings.SplitN(alert.Check, ".", 2) + if len(parts) == 2 { + file = core.FindAsset(cfg, filepath.Join(parts[0], name)) + } + } if file == "" { return suggestions, fmt.Errorf("script '%s' not found", name) }