-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (29 loc) · 1.04 KB
/
python-codestyle.yml
File metadata and controls
35 lines (29 loc) · 1.04 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
name: python-codestyle
on:
pull_request:
types: [assigned, edited, opened, synchronize, reopened]
jobs:
check-python-code-style:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install pycodestype
run: |
python -m pip install --upgrade pip
pip install pycodestyle
which pycodestyle
- name: Check Python code style
run: |
echo "base ref: $GITHUB_BASE_REF"
git checkout $GITHUB_BASE_REF
echo "head ref: $GITHUB_HEAD_REF"
git checkout $GITHUB_HEAD_REF
git --no-pager diff $GITHUB_BASE_REF $GITHUB_HEAD_REF --name-only |grep ".py$" || { echo "No change on Python code"; exit 0; }
git --no-pager diff $GITHUB_BASE_REF $GITHUB_HEAD_REF --name-only |grep ".py$" |xargs pycodestyle --show-source --config=.pycodestyle