Automator: Change to selected directory and run shell script
The problem here is you have the input being passed to stdin. I don't know why that's the default, but you should be able to just change the popup menu in the top right to "as arguments." I did that and added cd "$1" to the top of the script and it worked.