From 67e332e838cbd477ef424213d96ac6a34b6ab2b7 Mon Sep 17 00:00:00 2001 From: ChristopherHX Date: Wed, 11 Jun 2025 19:36:11 +0200 Subject: [PATCH] fix: GITHUB_ENV and GITHUB_OUTPUT allow larger lines (#5028) --- cmd/root.go | 1 + pkg/container/parse_env_file.go | 3 ++- pkg/runner/run_context.go | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 87f59ea..f51ed64 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -286,6 +286,7 @@ func readArgsFile(file string, split bool) []string { } }() scanner := bufio.NewScanner(f) + scanner.Buffer(nil, 1024*1024*1024) // increase buffer to 1GB to avoid scanner buffer overflow for scanner.Scan() { arg := os.ExpandEnv(strings.TrimSpace(scanner.Text())) diff --git a/pkg/container/parse_env_file.go b/pkg/container/parse_env_file.go index 9192762..b1c21f5 100644 --- a/pkg/container/parse_env_file.go +++ b/pkg/container/parse_env_file.go @@ -25,6 +25,7 @@ func parseEnvFile(e Container, srcPath string, env *map[string]string) common.Ex return err } s := bufio.NewScanner(reader) + s.Buffer(nil, 1024*1024*1024) // increase buffer to 1GB to avoid scanner buffer overflow firstLine := true for s.Scan() { line := s.Text() @@ -63,6 +64,6 @@ func parseEnvFile(e Container, srcPath string, env *map[string]string) common.Ex } } env = &localEnv - return nil + return s.Err() } } diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go index b6b6a48..f6e4dec 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -523,6 +523,7 @@ func (rc *RunContext) UpdateExtraPath(ctx context.Context, githubEnvPath string) return err } s := bufio.NewScanner(reader) + s.Buffer(nil, 1024*1024*1024) // increase buffer to 1GB to avoid scanner buffer overflow firstLine := true for s.Scan() { line := s.Text() @@ -537,7 +538,7 @@ func (rc *RunContext) UpdateExtraPath(ctx context.Context, githubEnvPath string) rc.addPath(ctx, line) } } - return nil + return s.Err() } // stopJobContainer removes the job container (if it exists) and its volume (if it exists)