Skip to content

Commit b13f430

Browse files
committed
fix: install gh cli if it is not installed
Signed-off-by: Lukas Hankeln <lukashankeln@googlemail.com>
1 parent bc970be commit b13f430

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/automerge-approved.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ on:
3030
required: false
3131
default: 'self-hosted'
3232
type: string
33+
gh_version:
34+
description: 'GitHub CLI version to install (e.g. v2.72.0)'
35+
required: false
36+
default: 'v2.72.0' # renovate: datasource=github-releases depName=cli/cli
37+
type: string
3338

3439
jobs:
3540
automerge:
@@ -59,6 +64,22 @@ jobs:
5964
private-key: ${{ secrets.APP_PRIVATE_KEY }}
6065
owner: ${{ github.repository_owner }}
6166

67+
- name: Install GitHub CLI
68+
env:
69+
GH_VERSION: ${{ inputs.gh_version }}
70+
run: |
71+
ARCH=$(uname -m)
72+
case "${ARCH}" in
73+
x86_64) ARCH=amd64 ;;
74+
aarch64) ARCH=arm64 ;;
75+
armv6l) ARCH=armv6 ;;
76+
*) echo "Unsupported architecture: ${ARCH}"; exit 1 ;;
77+
esac
78+
VERSION="${GH_VERSION#v}"
79+
curl -fsSL "https://github.com/cli/cli/releases/download/v${VERSION}/gh_${VERSION}_linux_${ARCH}.tar.gz" \
80+
| tar -xz -C /tmp
81+
echo "/tmp/gh_${VERSION}_linux_${ARCH}/bin" >> $GITHUB_PATH
82+
6283
- name: Merge labelled PRs
6384
env:
6485
GH_TOKEN: ${{ steps.generate-token.outputs.token || secrets.RELEASE_TOKEN || github.token }}

0 commit comments

Comments
 (0)