Always use proper quoting in shell scripts (especially GitHub Actions workflows) to prevent word splitting, globbing, and ensure correct variable expansion:
Always use proper quoting in shell scripts (especially GitHub Actions workflows) to prevent word splitting, globbing, and ensure correct variable expansion:
# Incorrect
go list -f '/...' -m | xargs go test -short -covermode=atomic -timeout=5m
# Correct
go list -f '/...' -m | xargs bash -c "go test -short -covermode=atomic -timeout=5m"
# Incorrect - variables won't expand in single quotes
echo 'Value: $SOME_VAR'
# Correct - allows variable expansion
echo "Value: $SOME_VAR"
# Incorrect
if [ $status == success ]; then
# Correct
if [ "$status" == "success" ]; then
These practices prevent common shell scripting errors that tools like shellcheck will flag (SC2046, SC2016, SC2086), resulting in more robust and predictable scripts.
Enter the URL of a public GitHub repository