Skip to content

Commit f81e08e

Browse files
committed
Use reviewdog for PR comments
1 parent c6a653d commit f81e08e

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ to our style guide for python code at celebrate company.
1414
This action ONLY runs the linters.
1515
The python environment should be set up separately.
1616

17+
MAKE SURE TO PROVIDE YOUR OWN LINTER CONFIGURATION FILES IN YOUR REPOSITORY.
18+
1719
```yaml
1820
name: celebrate python linting
19-
uses: kartenmacherei/[email protected].1
21+
uses: kartenmacherei/[email protected].6
2022
```
2123
2224
## Features
2325
24-
- Runs python linters one after the other; fails with the first failing linter
26+
- Runs all specified python linters
2527
- If triggered by a pull request, linter results will be added as comments to the PR.
28+
- If triggered by a different kind of commit, linter results will be added as check errors.

action.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ inputs:
88
runs:
99
using: "composite"
1010
steps:
11-
- name: Check dependencies
11+
- name: Check reporter type
12+
id: reporter-check
1213
shell: bash
13-
run: flake8 --version && pylint --version && lintly --help > /dev/null || pip install -U -r requirements.txt
14+
run: |
15+
if [ ${{ github.event_name }} = "pull_request" ]; then
16+
echo "::set-output name=reporter::github-pr-review"
17+
else
18+
echo "::set-output name=reporter::github-check"
19+
fi
1420
1521
- name: Detect changed files
1622
uses: dorny/[email protected]
@@ -25,20 +31,16 @@ runs:
2531
uses: reviewdog/action-flake8@v3
2632
with:
2733
flake8_args: ${{ steps.changes.outputs.addedOrModifiedPython_files }}
28-
reporter: github-pr-review
34+
reporter: ${{ steps.reporter-check.outputs.reporter }}
2935

3036
- name: mypy
3137
uses: tsuyoshicho/[email protected]
3238
with:
3339
target: ${{ steps.changes.outputs.addedOrModifiedPython }}
34-
reporter: github-pr-review
35-
fail_on_error: true
40+
reporter: ${{ steps.reporter-check.outputs.reporter }}
3641

3742
- name: pylint
38-
shell: bash
39-
run: |
40-
python $GITHUB_ACTION_PATH/linting_orchestrator.py ${{ github.event_name == 'pull_request' }} pylint ${{ steps.changes.outputs.addedOrModifiedPython_files }}
41-
env:
42-
GITHUB_TOKEN: ${{ inputs.github_token }}
43-
PR_NUMBER: ${{ github.event.number }}
44-
REPOSITORY_NAME: ${{ github.repository }}
43+
uses: dciborow/[email protected]
44+
with:
45+
glob_pattern: ${{ steps.changes.outputs.addedOrModifiedPython_files }}
46+
reporter: ${{ steps.reporter-check.outputs.reporter }}

0 commit comments

Comments
 (0)