From 1ba146087dac7ac21b796b863905143d920e6434 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 25 Jun 2024 21:15:53 -0600 Subject: [PATCH 1/4] fix: error installing reviewdog on windows runners --- install.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 293737e..a62553a 100755 --- a/install.sh +++ b/install.sh @@ -31,7 +31,16 @@ echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/review echo "curl or wget is required" >&2 exit 1 fi -) | sh -s -- -b "${TEMP}/reviewdog/bin" "${VERSION}" 2>&1 +) | sh -s -- -b "${TEMP}/reviewdog/bin" "${VERSION}" 2>&1 || { + echo "Failed to install reviewdog. Attempting to fetch the latest tag from GitHub." + LATEST_TAG=$(curl -s https://api.github.com/repos/reviewdog/reviewdog/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + if [ -z "${LATEST_TAG}" ]; then + echo "Unable to find the latest tag on GitHub. Exiting." + exit 1 + fi + echo "Found latest tag: ${LATEST_TAG}. Retrying installation." + curl -sfL "${INSTALL_SCRIPT}" | sh -s -- -b "${TEMP}/reviewdog/bin" "${LATEST_TAG}" 2>&1 +} echo '::endgroup::' echo "${TEMP}/reviewdog/bin" >>"${GITHUB_PATH}" From 13d3f33fa5c63168789812d265ca49a36f3ad88f Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 25 Jun 2024 21:25:13 -0600 Subject: [PATCH 2/4] Update action.yml --- action.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index f687a43..014cf5d 100644 --- a/action.yml +++ b/action.yml @@ -9,17 +9,15 @@ runs: steps: - name: install reviewdog run: | - set -eu - "$GITHUB_ACTION_PATH/install.sh" - shell: sh + bash "$GITHUB_ACTION_PATH/install.sh" + shell: bash env: REVIEWDOG_VERSION: ${{ inputs.reviewdog_version }} REVIEWDOG_TEMPDIR: ${{ runner.temp }} - name: check reviewdog is successfully installed run: | - set -eu - "$GITHUB_ACTION_PATH/check-installed.sh" - shell: sh + bash "$GITHUB_ACTION_PATH/check-installed.sh" + shell: bash # Ref: https://haya14busa.github.io/github-action-brandings/ branding: From a56f9523afe8d1c30ed7b4d65c07e6a3b8ca2e5d Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 25 Jun 2024 21:25:40 -0600 Subject: [PATCH 3/4] Update check-installed.sh --- check-installed.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/check-installed.sh b/check-installed.sh index fe649fc..183bfff 100755 --- a/check-installed.sh +++ b/check-installed.sh @@ -1,4 +1,6 @@ -#!/bin/sh +#!/usr/bin/env bash + +set -eu if ! command -v reviewdog >/dev/null 2>&1; then echo "reviewdog was not installed" From 859a41f594e50b850cf4cab3f7c31ee362cd5bac Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 25 Jun 2024 21:25:53 -0600 Subject: [PATCH 4/4] Update install.sh --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index a62553a..41844b2 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash set -eu