How to get the PATH from .bashrc in JavaScript GitHub Action?

This is a general problem with GitHub Actions and to have the PATH and other environment variables properly set up, we add the following to the top of our workflows:

defaults:
  run:
    shell: bash -leo pipefail {0}

That changes the shell that is used for commands so that it sources .bashrc. This is important to us, since we are using macOS runners and binaries installed with brew aren’t in the default PATH. (There are also a few other reasons we need it.)

A colleague of mine has written a custom JavaScript action that executes a command that is in different locations on differnet runners, depending on OS and CPU architecture. To support all architectures, he’s appending all locations to the PATH before executing the command:

PATH=$PATH:location1:location2 command

Another colleague of mine added a new runner type that installed the binaries to a third location. To be able to support the JavaScript action, he added symlinks to “location1” so that the command would be found by the action, without having to update the PATH in the action.

It’s a bit of a mess and it could easily be cleaned up if I could get the JavaScript action to source .bashrc and have the proper PATH available. Only problem is that I don’t know how to do that. It would be nice if there was some option I could pass to make it do that:

runs:
  using: 'node16'
  main: 'dist/index.js'

I could probably source .bashrc from within the JavaScript and I would accept such answers, as long it’s not too messy.