fix: GITHUB_ENV and GITHUB_OUTPUT allow larger lines (#112)

* Specify larger buffer
This commit is contained in:
ChristopherHX
2025-06-03 22:59:05 +02:00
committed by GitHub
parent 9d4a12f0b7
commit d5a1a09aa4
3 changed files with 5 additions and 2 deletions

View File

@@ -287,6 +287,7 @@ func readArgsFile(file string, split bool) []string {
} }
}() }()
scanner := bufio.NewScanner(f) scanner := bufio.NewScanner(f)
scanner.Buffer(nil, 1024*1024*1024) // increase buffer to 1GB to avoid scanner buffer overflow
for scanner.Scan() { for scanner.Scan() {
arg := os.ExpandEnv(strings.TrimSpace(scanner.Text())) arg := os.ExpandEnv(strings.TrimSpace(scanner.Text()))

View File

@@ -25,6 +25,7 @@ func parseEnvFile(e Container, srcPath string, env *map[string]string) common.Ex
return err return err
} }
s := bufio.NewScanner(reader) s := bufio.NewScanner(reader)
s.Buffer(nil, 1024*1024*1024) // increase buffer to 1GB to avoid scanner buffer overflow
firstLine := true firstLine := true
for s.Scan() { for s.Scan() {
line := s.Text() line := s.Text()
@@ -63,6 +64,6 @@ func parseEnvFile(e Container, srcPath string, env *map[string]string) common.Ex
} }
} }
env = &localEnv env = &localEnv
return nil return s.Err()
} }
} }

View File

@@ -562,6 +562,7 @@ func (rc *RunContext) UpdateExtraPath(ctx context.Context, githubEnvPath string)
return err return err
} }
s := bufio.NewScanner(reader) s := bufio.NewScanner(reader)
s.Buffer(nil, 1024*1024*1024) // increase buffer to 1GB to avoid scanner buffer overflow
firstLine := true firstLine := true
for s.Scan() { for s.Scan() {
line := s.Text() line := s.Text()
@@ -576,7 +577,7 @@ func (rc *RunContext) UpdateExtraPath(ctx context.Context, githubEnvPath string)
rc.addPath(ctx, line) rc.addPath(ctx, line)
} }
} }
return nil return s.Err()
} }
// stopJobContainer removes the job container (if it exists) and its volume (if it exists) // stopJobContainer removes the job container (if it exists) and its volume (if it exists)