From b002600d92a3cf4c0be7abb8bc624a4b7ba25592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Steinh=C3=A4user?= <42437185+leonsteinhaeuser@users.noreply.github.com> Date: Thu, 14 Jul 2022 20:19:09 +0200 Subject: [PATCH] feature: install gh cli if not present (#39) * feature: added a check if the gh cli binary needs to be installed * enhancement: added the dependency check --- action.yml | 4 ++++ deps.sh | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100755 deps.sh diff --git a/action.yml b/action.yml index 70957f0..3c7a133 100644 --- a/action.yml +++ b/action.yml @@ -58,6 +58,10 @@ branding: runs: using: "composite" steps: + - name: "Install the gh cli tool if not installed" + shell: bash + run: ./deps.sh + - name: "Error missing auth conf" if: inputs.gh_app_secret_key == '' && inputs.gh_app_ID == '' && inputs.gh_token == '' shell: bash diff --git a/deps.sh b/deps.sh new file mode 100755 index 0000000..b8e71f7 --- /dev/null +++ b/deps.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# check if gh binary is available +if [ -x "$(command -v gh)" ]; then + echo 'gh cli is installed.' + exit 0 +fi + +version=${GH_CLI_VERSION:-2.8.0} +echo "Installing gh cli in version: $version" + +wget https://github.com/cli/cli/releases/download/v${version}/gh_${version}_linux_amd64.tar.gz +tar -xvf gh_${version}_linux_amd64.tar.gz +sudo cp $(pwd)/gh_${version}_linux_amd64/bin/gh /usr/local/bin/ \ No newline at end of file