I think you'll find that it's always the same issue when a question title includes "Shell Script". (The question is asked dozens of times every year, and you will find quite a lot of coverage of it here).
The point is that (fortunately for debugging, script sharing etc etc) an Execute Shell Script action gets a pristine vanilla instance of the shell.
It doesn't depend on, and not related to, the instance set up by other applications like Terminal.app, and it needs you to either:
- Define a value for
$PATH
which includes the path to application which you want to call, - or directly supply the full path to applications like
code
On this system, for example, I would replace:
code .
with
/usr/local/bin/code .
For a more generic and local approach, see, for example: