Skip to content

Commit

Permalink
Merge pull request #27 from reviewdog/fix-issue19
Browse files Browse the repository at this point in the history
fix #19
  • Loading branch information
shogo82148 committed Aug 5, 2023
2 parents 8e48baa + 07c4ffd commit 80a0661
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 23 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
sudo cp "shellcheck-${scversion}/shellcheck" /usr/local/bin/
rm -rf "shellcheck-${scversion}/shellcheck"
- run: shellcheck -f diff $(shfmt -f .) | patch -p1
- run: shellcheck -f diff "$(shfmt -f .)" | patch -p1
- name: suggester / shellcheck
uses: reviewdog/action-suggester@master
with:
Expand Down Expand Up @@ -74,3 +74,14 @@ jobs:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: warning

actionlint:
name: runner / actionlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: reviewdog/action-actionlint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: warning
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,13 @@ jobs:
with:
reviewdog_version: v0.10.0
- run: test "$(reviewdog -version)" = '0.10.0'

container:
runs-on: ubuntu-latest
container:
image: alpine:latest
steps:
- uses: actions/checkout@v3
- name: install reviewdog
uses: ./
- run: reviewdog -version
35 changes: 17 additions & 18 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
name: 'Setup reviewdog'
description: '🐶 This action sets up reviewdog'
name: "Setup reviewdog"
description: "🐶 This action sets up reviewdog"
inputs:
reviewdog_version:
description: 'reviewdog version. [latest,nightly,vX.Y.Z]'
default: 'latest'
description: "reviewdog version. [latest,nightly,vX.Y.Z]"
default: "latest"
runs:
using: 'composite'
using: "composite"
steps:
- run: $GITHUB_ACTION_PATH/install.sh
shell: bash
- name: install reviewdog
run: |
set -eu
"$GITHUB_ACTION_PATH/install.sh"
shell: sh
env:
REVIEWDOG_VERSION: ${{ inputs.reviewdog_version }}
REVIEWDOG_TEMPDIR: ${{ runner.temp }}
- run: |
if ! command -v reviewdog >/dev/null 2>&1; then
echo "reviewdog was not installed"
exit 1
fi
echo "::group::📖 reviewdog -h"
reviewdog -h 2>&1 || true
echo "::endgroup::"
shell: bash
- name: check reviewdog is successfully installed
run: |
set -eu
"$GITHUB_ACTION_PATH/check-installed.sh"
shell: sh

# Ref: https://haya14busa.github.io/github-action-brandings/
branding:
icon: 'terminal'
color: 'gray-dark'
icon: "terminal"
color: "gray-dark"
9 changes: 9 additions & 0 deletions check-installed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

if ! command -v reviewdog >/dev/null 2>&1; then
echo "reviewdog was not installed"
exit 1
fi
echo "::group::📖 reviewdog -h"
reviewdog -h 2>&1 || true
echo "::endgroup::"
17 changes: 13 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/sh

set -euo pipefail
set -eu

VERSION="${REVIEWDOG_VERSION:-latest}"

Expand All @@ -14,15 +14,24 @@ if [ -z "${TEMP}" ]; then
fi

INSTALL_SCRIPT='https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh'
if [ "${VERSION}" == 'nightly' ] ; then
if [ "${VERSION}" = 'nightly' ]; then
INSTALL_SCRIPT='https://raw.githubusercontent.com/reviewdog/nightly/master/install.sh'
VERSION='latest'
fi

mkdir -p "${TEMP}/reviewdog/bin"

echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
curl -sfL "${INSTALL_SCRIPT}" | sh -s -- -b "${TEMP}/reviewdog/bin" "${VERSION}" 2>&1
(
if command -v curl 2>&1 >/dev/null; then
curl -sfL "${INSTALL_SCRIPT}"
elif command -v wget 2>&1 >/dev/null; then
wget -O - "${INSTALL_SCRIPT}"
else
echo "curl or wget is required" >&2
exit 1
fi
) | sh -s -- -b "${TEMP}/reviewdog/bin" "${VERSION}" 2>&1
echo '::endgroup::'

echo "${TEMP}/reviewdog/bin" >>"${GITHUB_PATH}"

0 comments on commit 80a0661

Please sign in to comment.