Skip to content

Commit

Permalink
Use reviewdog for PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mnschmit committed May 9, 2023
1 parent c6a653d commit f81e08e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ to our style guide for python code at celebrate company.
This action ONLY runs the linters.
The python environment should be set up separately.

MAKE SURE TO PROVIDE YOUR OWN LINTER CONFIGURATION FILES IN YOUR REPOSITORY.

```yaml
name: celebrate python linting
uses: kartenmacherei/python-code-style@0.0.1
uses: kartenmacherei/python-code-style@0.0.6
```
## Features
- Runs python linters one after the other; fails with the first failing linter
- Runs all specified python linters
- If triggered by a pull request, linter results will be added as comments to the PR.
- If triggered by a different kind of commit, linter results will be added as check errors.
26 changes: 14 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ inputs:
runs:
using: "composite"
steps:
- name: Check dependencies
- name: Check reporter type
id: reporter-check
shell: bash
run: flake8 --version && pylint --version && lintly --help > /dev/null || pip install -U -r requirements.txt
run: |
if [ ${{ github.event_name }} = "pull_request" ]; then
echo "::set-output name=reporter::github-pr-review"
else
echo "::set-output name=reporter::github-check"
fi
- name: Detect changed files
uses: dorny/paths-filter@v2.11.1
Expand All @@ -25,20 +31,16 @@ runs:
uses: reviewdog/action-flake8@v3
with:
flake8_args: ${{ steps.changes.outputs.addedOrModifiedPython_files }}
reporter: github-pr-review
reporter: ${{ steps.reporter-check.outputs.reporter }}

- name: mypy
uses: tsuyoshicho/action-mypy@v3.11.0
with:
target: ${{ steps.changes.outputs.addedOrModifiedPython }}
reporter: github-pr-review
fail_on_error: true
reporter: ${{ steps.reporter-check.outputs.reporter }}

- name: pylint
shell: bash
run: |
python $GITHUB_ACTION_PATH/linting_orchestrator.py ${{ github.event_name == 'pull_request' }} pylint ${{ steps.changes.outputs.addedOrModifiedPython_files }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
PR_NUMBER: ${{ github.event.number }}
REPOSITORY_NAME: ${{ github.repository }}
uses: dciborow/action-pylint@0.1.0
with:
glob_pattern: ${{ steps.changes.outputs.addedOrModifiedPython_files }}
reporter: ${{ steps.reporter-check.outputs.reporter }}

0 comments on commit f81e08e

Please sign in to comment.