title: Running a login shell in GitHub Actions
body: <p>I want to use a login shell in my GitHub Action and after countless hours I cannot get it to work.</p>
  <p>Here <a href="https://github.com/lobis/radiation-transport/actions/runs/1495875597" rel="nofollow noreferrer">https://github.com/lobis/radiation-transport/actions/runs/1495875597</a> is an example of the failed workflow.</p>
  <p>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 <code>/root/.bashrc</code>.</p>
  <p>The action (a cmake build) fails because the .bashrc is not being sourced (in particular it populates <code>LD_LIBRARY_PATH</code>, that is why it doesn't find the library and exits with error).</p>
  <p>I have tried to source it in many ways from GitHub actions and the Dockerfile.</p>
  <p>The most promising post is <a href="https://github.community/t/self-hosted-not-using-bashrc/18358/2" rel="nofollow noreferrer">https://github.community/t/self-hosted-not-using-bashrc/18358/2</a> which defines</p>
  <pre><code>defaults:
    run:
      shell: bash -leo pipefail {0} # Removed &quot; --noprofile --norc &quot; options from default bash
  </code></pre>
  <p>but this does not work in my case.</p>
  <p>I made a related post in the past (<a href="https://stackoverflow.com/questions/66560782/equivalent-of-sourcing-bashrc-when-building-dockerfile">Equivalent of sourcing ~/.bashrc when building Dockerfile</a>) 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.</p>
  <p>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 <a href="https://github.com/lobis/radiation-transport/runs/4302779785?check_suite_focus=true" rel="nofollow noreferrer">https://github.com/lobis/radiation-transport/runs/4302779785?check_suite_focus=true</a>)</p>
  <p>Thanks.</p>