0

I used to have a script

      wget https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz
      mkdir sfdx-cli
      tar xJf sfdx-linux-amd64.tar.xz -C sfdx-cli --strip-components 1
      ./sfdx-cli/install
      sfdx update

in my github actions to install sfdx cli before any other steps or actions, it was broken today and stopped working.

When I tried to update the script to the following version

wget https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz
mkdir ~/sfdx
tar xJf sfdx-linux-x64.tar.xz -C ~/sfdx --strip-components 1
export PATH=~/sfdx/bin:$PATH
sfdx update

it still doesn't work because the calling sfdx from the other steps produces an error

line 1: sfdx: command not found

Is there a fix or workaround for that?

2 Answers 2

1

Looks like there is an easy solution for this:

node --version
npm install sfdx-cli --global

looks like node is already installed in Github Actions servers.

1

You may also want to leverage the official SFDX Docker image in your GitHub Action as well.

Here is my sample GitHub Action file:

https://github.com/banderson5144/funcondemo/blob/master/.github/workflows/sfdxvalidate.yml#L18

And here is the link to the official SFDX Docker Image:

https://hub.docker.com/r/salesforce/salesforcedx

3
  • this is really interesting option, however, when I try to use it, the following preexisting command now fails: limits=$(sfdx force:limits:api:display -u devhub | awk '$1 ~ /ScratchOrg/ { print }') limits=$(sfdx force:limits:api:display -u devhub | awk '$1 ~ /ScratchOrg/ { print }') echo $limits limits="${limits//'%'/'%25'}" limits="${limits//$'\n'/'%0A'}" limits="${limits//$'\r'/'%0D'}" echo "::set-output name=limits::$limits" : Bad substitution
    – Patlatus
    Apr 1, 2022 at 7:47
  • for some strange reason some commands like git rev-parse HEAD started failing with 128 and I don't understand why This started after switching to docker image
    – Patlatus
    Apr 1, 2022 at 8:59
  • SFDX docker image has obsolete git version 2.17.1
    – Patlatus
    Apr 1, 2022 at 9:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .