As Allan said, the shell environment variables, such as $PATH, are typically set in the shell configuration files (e.g., ~/.bashrc or ~/.zshrc). However, when you use Automator's "run shell script" action, it does not necessarily load your shell configuration files, which may result in a different $PATH variable than what you have in your terminal.
To ensure that you have the same $PATH variable in Automator's "run shell script" action as in your terminal, you can explicitly set the $PATH variable in your script. You can do this by adding the following line at the beginning of your shell script:
This command sets the $PATH variable to the existing value of $PATH (represented by "$PATH") plus any additional directories you want to add (separated by colons).
Alternatively, you can source your shell configuration file at the beginning of the script by adding the following line:
This command sources your ~/.zshrc file, which will set the $PATH variable to its proper value.
By doing either of these, you can ensure that your "run shell script" action in Automator has the same $PATH variable as your terminal.