Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error installing reviewdog on windows runners #43

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion check-installed.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
13 changes: 11 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

set -eu

Expand Down Expand Up @@ -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}"
Loading