From 6cc10e3f4fbe3ccca3d02521d0430f73b3e24016 Mon Sep 17 00:00:00 2001 From: yage Date: Mon, 13 Nov 2023 13:16:04 -0700 Subject: [PATCH] v3.7.7 ===================================================================== --- New Features ------------------------- - GitHub Actions now autodetects groups within the "$GITHUB_WORKSPACE" --- README.md | 1 + zsh/lib/config.zsh | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index cc66be2..14bcdc1 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ There are a few notable changes to this runtime: - Other user input will default to an empty string - Logs will not be captured - Setting the environment variable `SCWRYPTS_GROUP_LOADER__[a-z_]\+` will source the file indicated in the variable (this allows custom groups without needing to modify the `config.zsh` directly) + - In GitHub actions, `*.scwrypts.zsh` groups are detected automatically from the `$GITHUB_WORKSPACE`; set `SCWRYPTS_GITHUB_NO_AUTOLOAD=true` to disable ## Contributing diff --git a/zsh/lib/config.zsh b/zsh/lib/config.zsh index 3126d61..c8615ab 100644 --- a/zsh/lib/config.zsh +++ b/zsh/lib/config.zsh @@ -54,6 +54,19 @@ do [ -f "$GROUP_LOADER" ] && source "$GROUP_LOADER" done +: \ + && [ ! "$SCWRYPTS_AUTODETECT_GROUP_BASEDIR" ] \ + && [ $GITHUB_WORKSPACE ] \ + && [ ! $SCWRYPTS_GITHUB_NO_AUTOLOAD ] \ + && SCWRYPTS_AUTODETECT_GROUP_BASEDIR="$GITHUB_WORKSPACE" + +[ "$SCWRYPTS_AUTODETECT_GROUP_BASEDIR" ] && [ -d "$SCWRYPTS_AUTODETECT_GROUP_BASEDIR" ] && { + for GROUP_LOADER in $(find "$SCWRYPTS_AUTODETECT_GROUP_BASEDIR" -type f -name \*scwrypts.zsh) + do + [ -f "$GROUP_LOADER" ] && source "$GROUP_LOADER" + done +} + ##################################################################### [ $NO_EXPORT_CONFIG ] || __SCWRYPT=1 # arbitrary; indicates currently inside a scwrypt true