diff --git a/acceptance_tests/basic.sh b/acceptance_tests/basic.sh index 55f1234c58..aeb453d105 100755 --- a/acceptance_tests/basic.sh +++ b/acceptance_tests/basic.sh @@ -86,6 +86,12 @@ testBasicCatWithFilesNoDash() { assertEquals "$Y" "$X" } +# when the nullinput flag is used +# dont automatically read STDIN (this breaks github actions) +testBasicCreateFileGithubAction() { + cat /dev/null | ./yq -n ".a = 123" > test.yml +} + testBasicEvalAllCatWithFilesNoDash() { ./yq -n ".a = 123" > test.yml ./yq -n ".a = 124" > test2.yml diff --git a/cmd/utils.go b/cmd/utils.go index 0354037ce5..1a3086b87c 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -126,7 +126,7 @@ func processStdInArgs(args []string) []string { // read from stdin. // this happens if there is more than one argument // or only one argument and its a file - if !pipingStdin || len(args) > 1 || (len(args) > 0 && maybeFile(args[0])) { + if nullInput || !pipingStdin || len(args) > 1 || (len(args) > 0 && maybeFile(args[0])) { return args }