Skip to content

Commit

Permalink
Fix action not working on npm v9 (#162)
Browse files Browse the repository at this point in the history
* update workflow badges in readme

* use npm root to locate installed tsc version

* Update script.sh

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
EPMatt and github-actions[bot] authored Mar 6, 2023
1 parent 1bf95a1 commit d026aa1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# reviewdog-action-tsc

![Maintained](https://img.shields.io/badge/maintained-yes-brightgreen)
[![Test](https://github.com/EPMatt/reviewdog-action-tsc/workflows/Tests/badge.svg)](https://github.com/EPMatt/reviewdog-action-tsc/actions?query=workflow%3ATest)
[![Code Quality](https://github.com/EPMatt/reviewdog-action-tsc/workflows/Code%20Quality/badge.svg)](https://github.com/EPMatt/reviewdog-action-tsc/actions?query=workflow%3Areviewdog)
[![Deps auto update](https://github.com/EPMatt/reviewdog-action-tsc/workflows/Deps%20auto%20update/badge.svg)](https://github.com/EPMatt/reviewdog-action-tsc/actions?query=workflow%3Adepup)
[![Release](https://github.com/EPMatt/reviewdog-action-tsc/workflows/Release/badge.svg)](https://github.com/EPMatt/reviewdog-action-tsc/actions?query=workflow%3Arelease)
[![Tests](https://github.com/EPMatt/reviewdog-action-tsc/actions/workflows/test.yml/badge.svg)](https://github.com/EPMatt/reviewdog-action-tsc/actions/workflows/test.yml)
[![Code Quality](https://github.com/EPMatt/reviewdog-action-tsc/actions/workflows/reviewdog.yml/badge.svg)](https://github.com/EPMatt/reviewdog-action-tsc/actions/workflows/reviewdog.yml)
[![Deps auto update](https://github.com/EPMatt/reviewdog-action-tsc/actions/workflows/depup.yml/badge.svg)](https://github.com/EPMatt/reviewdog-action-tsc/actions/workflows/depup.yml)
[![Release](https://github.com/EPMatt/reviewdog-action-tsc/actions/workflows/release.yml/badge.svg)](https://github.com/EPMatt/reviewdog-action-tsc/actions/workflows/release.yml)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/EPMatt/reviewdog-action-tsc?logo=github&sort=semver)](https://github.com/EPMatt/reviewdog-action-tsc/releases)
[![action-bumpr supported](https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github&link=https://github.com/haya14busa/action-bumpr)](https://github.com/haya14busa/action-bumpr)

Expand Down
10 changes: 5 additions & 5 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit 1

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

if [ ! -f "$(npm bin)"/tsc ]; then
if [ ! -f "$(npm root)"/.bin/tsc ]; then
echo "::group::🔄 Running npm install to install tsc ..."
npm install
echo "::endgroup::"
fi

if [ ! -f "$(npm bin)"/tsc ]; then
if [ ! -f "$(npm root)"/.bin/tsc ]; then
echo "❌ Unable to locate or install tsc. Did you provide a workdir which contains a valid package.json?"
exit 1
else

echo ℹ️ tsc version: "$("$(npm bin)"/tsc --version)"
echo ℹ️ tsc version: "$("$(npm root)"/.bin/tsc --version)"

echo "::group::📝 Running tsc with reviewdog 🐶 ..."

# shellcheck disable=SC2086
"$(npm bin)"/tsc ${INPUT_TSC_FLAGS} \
| reviewdog -f=tsc \
"$(npm root)"/.bin/tsc ${INPUT_TSC_FLAGS} |
reviewdog -f=tsc \
-name="${INPUT_TOOL_NAME}" \
-reporter="${INPUT_REPORTER}" \
-filter-mode="${INPUT_FILTER_MODE}" \
Expand Down

0 comments on commit d026aa1

Please sign in to comment.