Using system aliases in workflow (self-hosted runner)

Hello everyone,

In self-hosted runner (Ubuntu 20.x, runner executed as user u) I have such alias defined in the OS layer:

alias nodejs="node"

I set above alias in the following locations (as you can see below, neither of them works):

  • /home/u/.bash_aliases
  • /etc/profile.d/custom-aliases.sh
  • /etc/bash.bashrc

Then I execute such workflow step:

      - name: Test alias.
        run: |
          echo "Whoami:"
          whoami
          echo "Aliases:"
          alias
          echo "Node:"
          node --version
          echo "NodeJS:"
          nodejs --version

Result is:

Whoami:
u
Aliases:
Node:
v14.15.1
NodeJS:
/home/u/runner/_work/_temp/d019c3b1-117e-4173-b000-49892165baf6.sh: line 8: nodejs: command not found

This alias does exist of course:

u@host:~$ nodejs --version
v14.17.0

Where an alias declaration should be placed so it can be used from within github action / workflow?