feat: add github-action make target and refactor builtin variables initialization

- Add github-action target to trigger manual and nightly release workflows
- Extract BuildBuiltinVariables() function for reusable context setup
- Simplify RandomString from 8-char alphanumeric to 6-char lowercase
- Update documentation for RandomString variable description
This commit is contained in:
j3ssie
2026-01-25 23:37:01 +08:00
parent 1fd3f09a9b
commit bef52a2223
4 changed files with 30 additions and 14 deletions
+9 -10
View File
@@ -6,7 +6,6 @@ import (
"io"
"os"
"os/signal"
"runtime"
"strings"
"sync"
"syscall"
@@ -294,16 +293,16 @@ func runBulkFunctionEval(printer *terminal.Printer, script string) error {
// executeFunctionForTarget executes the script for a single target
func executeFunctionForTarget(printer *terminal.Printer, script, target string) error {
// Build context with target and params
ctx := make(map[string]interface{})
// Inject platform detection variables (always available, even without target)
ctx["PlatformOS"] = runtime.GOOS
ctx["PlatformArch"] = runtime.GOARCH
ctx["PlatformInDocker"] = executor.DetectDocker()
ctx["PlatformInKubernetes"] = executor.DetectKubernetes()
ctx["PlatformCloudProvider"] = executor.DetectCloudProvider()
params := map[string]string{}
if target != "" {
params["target"] = target
}
if funcTargetsFile != "" {
params["target_file"] = funcTargetsFile
}
cfg := config.Get()
ctx := executor.BuildBuiltinVariables(cfg, params)
if target != "" {
ctx["target"] = target
}