Skip to content

Commit

Permalink
Switch to running pyright with npm exec (#34)
Browse files Browse the repository at this point in the history
* Switch to running pyright with `npm exec`

As suggested by @rnovacek in #33

* Apply suggestions from code review

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

* Disambiguate argument parsing

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
jordemort and github-actions[bot] authored Nov 11, 2022
1 parent 7e70a5b commit 7036723
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euo pipefail

BASE_PATH="$(cd "$(dirname "$0")" && pwd)"
INPUT_PYRIGHT_VERSION=${INPUT_PYRIGHT_VERSION:-latest}

cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit 1

Expand All @@ -14,14 +15,6 @@ echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/review
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" "${REVIEWDOG_VERSION}" 2>&1
echo '::endgroup::'

echo '::group::🐍 Installing pyright ...'
if [ -z "${INPUT_PYRIGHT_VERSION:-}" ]; then
npm install pyright
else
npm install "pyright@${INPUT_PYRIGHT_VERSION}"
fi
echo '::endgroup::'

PYRIGHT_ARGS=(--outputjson)

if [ -n "${INPUT_PYTHON_PLATFORM:-}" ]; then
Expand Down Expand Up @@ -64,9 +57,9 @@ trap cleanup EXIT
set -x

# shellcheck disable=SC2086
"$(npm bin)/pyright" "${PYRIGHT_ARGS[@]}" ${INPUT_PYRIGHT_FLAGS:-} > "$RDTMP/pyright.json" || true
npm exec --yes -- "pyright@${INPUT_PYRIGHT_VERSION}" "${PYRIGHT_ARGS[@]}" ${INPUT_PYRIGHT_FLAGS:-} >"$RDTMP/pyright.json" || true

python3 "${BASE_PATH}/pyright_to_rdjson/pyright_to_rdjson.py" < "$RDTMP/pyright.json" > "$RDTMP/rdjson.json"
python3 "${BASE_PATH}/pyright_to_rdjson/pyright_to_rdjson.py" <"$RDTMP/pyright.json" >"$RDTMP/rdjson.json"

set +e
# shellcheck disable=SC2086
Expand Down

0 comments on commit 7036723

Please sign in to comment.