From c3802479ecb6ac5ea3e886ff633758d28eb0df22 Mon Sep 17 00:00:00 2001 From: David Esposito Date: Wed, 8 Sep 2021 16:20:36 -0400 Subject: [PATCH] PMGR-9933 -- adds support for an additional Input to the GH Action specifying an alternative tarball to install for the CLI; useful for when 'latest' is hopelessly broken --- action.yml | 3 +++ index.js | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index b360dc1..8976395 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,9 @@ inputs: sfdx-auth-url: description: Authorize a Salesforce org using an SFDX auth URL required: false + tarball-url: + description: Supply a URL to a XZip'd tarball containing the version of the SFDX CLI to install. If omitted or blank, it will install the "latest" CLI + required: false runs: using: 'node12' main: 'index.js' diff --git a/index.js b/index.js index 8dd8ec1..b246a2f 100644 --- a/index.js +++ b/index.js @@ -9,9 +9,18 @@ try { } function installSFDX(){ - var download = 'wget https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz -q -P /tmp' + var tarballBase = 'https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable' + var tarballFile = 'sfdx-linux-x64.tar.xz' + + var tarballOverride = core.getInput('tarball-url') + if(tarballOverride ){ + tarballBase = tarballOverride.substr(0,tarballOverride.lastIndexOf('/')) + tarballFile = tarballOverride.substr(tarballOverride.lastIndexOf('/')+1) + } + + var download = 'wget ' + tarballBase + '/' + tarballFile + ' -q -P /tmp' var createDir = 'mkdir sfdx' - var unzip = 'tar xJf /tmp/sfdx-linux-x64.tar.xz -C sfdx --strip-components 1' + var unzip = 'tar xJf /tmp/' + tarballFile + ' -C sfdx --strip-components 1' var install = 'echo "`pwd`/sfdx/bin" >> $GITHUB_PATH' var version = 'sfdx/bin/sfdx --version && sfdx/bin/sfdx plugins --core' exec(download+' && '+createDir+' && '+unzip+' && '+install+' && '+version, function(error, stdout, stderr){