Skip to content

Commit b002600

Browse files
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
1 parent e3f254e commit b002600

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

action.yml

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ branding:
5858
runs:
5959
using: "composite"
6060
steps:
61+
- name: "Install the gh cli tool if not installed"
62+
shell: bash
63+
run: ./deps.sh
64+
6165
- name: "Error missing auth conf"
6266
if: inputs.gh_app_secret_key == '' && inputs.gh_app_ID == '' && inputs.gh_token == ''
6367
shell: bash

deps.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# check if gh binary is available
4+
if [ -x "$(command -v gh)" ]; then
5+
echo 'gh cli is installed.'
6+
exit 0
7+
fi
8+
9+
version=${GH_CLI_VERSION:-2.8.0}
10+
echo "Installing gh cli in version: $version"
11+
12+
wget https://github.com/cli/cli/releases/download/v${version}/gh_${version}_linux_amd64.tar.gz
13+
tar -xvf gh_${version}_linux_amd64.tar.gz
14+
sudo cp $(pwd)/gh_${version}_linux_amd64/bin/gh /usr/local/bin/

0 commit comments

Comments
 (0)