I want to use a login shell in my GitHub Action and after countless hours I cannot get it to work.
Here https://github.com/lobis/radiation-transport/actions/runs/1495875597 is an example of the failed workflow.
I am running the action from a container which itself has some software installed that initializes some key environment variables via bash script, which I have placed in /root/.bashrc.
The action (a cmake build) fails because the .bashrc is not being sourced (in particular it populates LD_LIBRARY_PATH, that is why it doesn't find the library and exits with error).
I have tried to source it in many ways from GitHub actions and the Dockerfile.
The most promising post is https://github.community/t/self-hosted-not-using-bashrc/18358/2 which defines
defaults:
run:
shell: bash -leo pipefail {0} # Removed " --noprofile --norc " options from default bash
but this does not work in my case.
I made a related post in the past (Equivalent of sourcing ~/.bashrc when building Dockerfile) where I tried to source the .bashrc in my Dockerfile but I think its just not possible, so I think using a login shell in the GitHub action is the way to go.
After many attemps, I have managed to get it to work via sourcing the relevant files in each step of the action, but I hope there is a better way to do this. (example where it works https://github.com/lobis/radiation-transport/runs/4302779785?check_suite_focus=true)
Thanks.