Skip to content

Commit

Permalink
Tiny tweaks (#5)
Browse files Browse the repository at this point in the history
* Change action description

* Tweak message formatting

* Pass all the env vars

* Tweak README

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* Suggestions

* Remove blank line

* Merge markdownlint and prettier suggestions

* Lint af

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Jordan Webb and github-actions[bot] authored Jun 4, 2021
1 parent dce6756 commit 5a94ea0
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 52 deletions.
4 changes: 1 addition & 3 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"extends": [
"config:base"
],
"extends": ["config:base"],
"rangeStrategy": "replace"
}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: release
on:
push:
branches:
- master
- main
tags:
- "v*.*.*"
pull_request:
Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/suggestions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,24 @@ jobs:
with:
tool_name: shellcheck / shfmt

markdown:
name: Markdown suggestions
markdownlint-prettier:
name: markdownlint and prettier suggestions
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: false

- run: sudo npm install -g markdownlint-cli

- run: markdownlint --fix --ignore site/_includes . || true

- name: suggester / markdown
uses: reviewdog/action-suggester@v1
with:
tool_name: markdownlint-cli

prettier:
name: Prettier suggestions
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: false

- run: sudo npm install -g prettier

- run: markdownlint --fix --ignore site/_includes . || true
- run: prettier -u -w '**/*.yaml' '**/.*.yaml' '**/*.yml' '**/.*.yml' '**/*.json' '**/*.md' || true

- name: suggester / prettier
uses: reviewdog/action-suggester@v1
with:
tool_name: prettier
tool_name: markdownlint / prettier

black:
name: Black formatter
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/jordemort/action-pyright?logo=github&sort=semver)](https://github.com/jordemort/action-pyright/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)

This is an action that runs [pyright](https://github.com/Microsoft/pyright) against your Python code, and uses [reviewdog](https://github.com/reviewdog/reviewdog) to create GitHub PR comments or reviews with the results.
This is an action that runs the [pyright](https://github.com/Microsoft/pyright) type checker against your Python code, and uses [reviewdog](https://github.com/reviewdog/reviewdog) to create GitHub PR comments or reviews with the results.

This action is based on [action-eslint](https://github.com/reviewdog/action-eslint) and inspired by [pyright-action](https://github.com/jakebailey/pyright-action).

You can configure pyright using [`pyrightconfig.json` or `pyproject.toml`](https://github.com/microsoft/pyright/blob/main/docs/configuration.md), or see the inputs below.

## Example usage

```yml
Expand All @@ -22,6 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: jordemort/action-pyright@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # You need this
reporter: github-pr-review # Change reporter.
lib: true
```
Expand Down Expand Up @@ -52,7 +55,7 @@ Default is added.

### `fail_on_error`

Optional. Exit code for reviewdog when errors are found [true,false]
Optional. Exit code for reviewdog when errors are found [true,false]
Default is `false`.

### `reviewdog_flags`
Expand Down
60 changes: 34 additions & 26 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
name: 'Run pyright with reviewdog'
description: '🐶 Run pyright with reviewdog on pull requests to improve code review experience.'
author: 'Jordan Webb (@jordemort)'
name: "Run pyright with reviewdog"
description: "🐶 Run pyright on pull requests and get reviews with reviewdog."
author: "Jordan Webb (@jordemort)"
inputs:
github_token:
description: 'GITHUB_TOKEN.'
description: "GITHUB_TOKEN."
required: true
default: ${{ github.token }}
level:
description: 'Report level for reviewdog [info,warning,error]'
description: "Report level for reviewdog [info,warning,error]"
required: false
default: 'error'
default: "error"
reporter:
description: |
Reporter of reviewdog command [github-check,github-pr-review].
Default is github-pr-review.
github-pr-review can use Markdown and add a link to rule page in reviewdog reports.
required: false
default: 'github-pr-review'
default: "github-pr-review"
filter_mode:
description: |
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is added.
required: false
default: 'added'
default: "added"
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
required: false
default: 'false'
default: "false"
reviewdog_flags:
description: 'Additional reviewdog flags'
description: "Additional reviewdog flags"
required: false
default: ''
default: ""
workdir:
description: "The directory from which to run pyright. Default '.'"
required: false
default: '.'
default: "."
tool_name:
description: 'Tool name to use for reviewdog reporter'
description: "Tool name to use for reviewdog reporter"
required: false
default: 'pyright'
default: "pyright"
pyright_version:
description: 'Version of pyright to run. If not specified, the latest version will be used.'
description: "Version of pyright to run. If not specified, the latest version will be used."
required: false
python_platform:
description: 'Analyze for a specific platform (Darwin, Linux, Windows).'
description: "Analyze for a specific platform (Darwin, Linux, Windows)."
required: false
python_version:
description: 'Analyze for a specific version (3.3, 3.4, etc.).'
description: "Analyze for a specific version (3.3, 3.4, etc.)."
required: false
typeshed_path:
description: 'Use typeshed type stubs at this location.'
description: "Use typeshed type stubs at this location."
required: false
venv_path:
description: 'Directory that contains virtual environments.'
description: "Directory that contains virtual environments."
required: false
project:
description: 'Use the configuration file at this location.'
description: "Use the configuration file at this location."
required: false
lib:
description: 'Use library code to infer types when stubs are missing.'
description: "Use library code to infer types when stubs are missing."
required: false
default: 'false'
default: "false"
pyright_flags:
description: 'Extra arguments; can be used to specify specific files to check.'
description: "Extra arguments; can be used to specify specific files to check."
required: false
runs:
using: 'composite'
using: "composite"
steps:
- run: $GITHUB_ACTION_PATH/script.sh
shell: bash
Expand All @@ -84,6 +84,14 @@ runs:
INPUT_ESLINT_FLAGS: ${{ inputs.eslint_flags }}
INPUT_WORKDIR: ${{ inputs.workdir }}
INPUT_TOOL_NAME: ${{ inputs.tool_name }}
INPUT_PYRIGHT_VERSION: ${{ inputs.pyright_version }}
INPUT_PYTHON_PLATFORM: ${{ inputs.python_platform }}
INPUT_PYTHON_VERSION: ${{ inputs.python_version }}
INPUT_TYPESHED_PATH: ${{ inputs.typeshed_path }}
INPUT_VENV_PATH: ${{ inputs.venv_path }}
INPUT_PROJECT: ${{ inputs.project }}
INPUT_LIB: ${{ inputs.lib }}
INPUT_PYRIGHT_FLAGS: ${{ inputs.pyright_flags }}
branding:
icon: 'alert-octagon'
color: 'blue'
icon: "alert-octagon"
color: "blue"
2 changes: 1 addition & 1 deletion pyright_to_rdjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def pyright_to_rdjson(jsonin: TextIO):
for d in pyright["generalDiagnostics"]:
rdjson["diagnostics"].append(
{
"message": d["rule"] + ": " + d["message"],
"message": f"{d['message']} ({d['rule']})",
"severity": d["serverity"].upper(),
"location": {
"path": d["file"],
Expand Down

0 comments on commit 5a94ea0

Please sign in to comment.