Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
98 lines (92 loc) · 2.69 KB
/
Copy pathaction.yml
File metadata and controls
98 lines (92 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: 'Python Actions Collection'
description: 'Run actions for Python Project on pull requests to improve code review experience.'
author: 'dciborow'
inputs:
# Python Project Configuration is expected to be in a pyproject.toml
root:
description: |
Project root directory.
Default '.'
default: '.'
toml:
description: |
pyproject.toml location.
Default pyproject.toml
default: 'pyproject.toml'
python_version:
description: |
Python Version
Default is '3.7'.
default: '3.7'
# Python Tooling
pylint:
description: |
Run Pylint
Default is false.
default: false
flake8:
description: |
Run Flake8
Default is false.
default: false
github_token:
description: 'GITHUB_TOKEN'
default: '${{ github.token }}'
workdir:
description: 'Working directory relative to the root directory.'
default: 'src'
### Flags for reviewdog ###
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'error'
reporter:
description: 'Reporter of reviewdog command [github-pr-check,github-pr-review].'
default: 'github-pr-check'
filter_mode:
description: |
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is added.
default: 'added'
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
runs:
using: "composite"
steps:
- if: ${{ inputs.flake8 == 'true' }}
run: |
if [ $(cat pyproject.toml | grep "tool.flake8") ]; then
python -m pip install --upgrade pip
python -m pip install flake8-pyproject
fi
shell: bash
- if: ${{ inputs.flake8 == 'true' }}
uses: reviewdog/action-flake8@v3
with:
github_token: ${{ inputs.github_token }}
workdir: ${{ inputs.root }}/${{ inputs.workdir }}
- if: ${{ inputs.pylint == 'true' }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
cache: 'pip' # caching pip dependencies
- if: ${{ inputs.pylint == 'true' }}
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install pylint
cd "${{ inputs.root }}/${{ inputs.workdir }}"
- if: ${{ inputs.pylint == 'true' }}
uses: dciborow/action-pylint@0.1.1
with:
github_token: ${{ inputs.github_token }}
workdir: ${{ inputs.root }}/${{ inputs.workdir }}
# Ref: https://haya14busa.github.io/github-action-brandings/
branding:
icon: 'check'
color: 'blue'