split_tests
split_tests copied to clipboard
issues with argument parsing
So I'm writing some scripts and for some reason argument parsing is really difficult.
So looking at this code https://github.com/chaosaffe/split-tests/blob/main/action.yml#L61 for some reason the environment variables aren't parsed correctly. Specifically $EXCLUDE_GLOB
I have to eval them like this https://github.com/ryanong/split-tests/blob/patch-1/action.yml#L61 in order for the arguments to get consumed correctly. I have tried turning the arguments into a bash array but to application still messes up.
example broken code of array
ARGS=("--split-index=0" "--split-total=3" "--glob='spec/**/*_spec.rb'" "--junit" "--junit-path='report-tmp/rspec-*.xml'" "--exclude-glob='spec/features/**/*_spec.rb'")
echo $ARGS[@]
./split_tests $ARGS[@]
shouldn't the command be ./split_tests $ARGS[*]? i am no expert on bash arrays, but google says so https://linuxhandbook.com/bash-arrays/
Doesn't work either. Try locally
so, coming back to this, sorry i can't pay more attention to this at the present... but looking at your source code - could it help if you pass the exclude-glob param, even if it's empty? basically as you are already doing with glob.
-glob='${{ inputs.glob }}' -exclude-glob='${{ inputs.exclude-glob }}'
it should just receive an empty string value for exclude-glob, and it's the same thing as not passing it. So technically, that should resolve this issue.