-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.37 KB
/
flake8-checker.yml
File metadata and controls
48 lines (40 loc) · 1.37 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
name: Lint with flake8 & correct with autopep8 on push
on:
push:
pull_request:
permissions:
contents: write
jobs:
lint:
name: Lint with flake8
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: ${{ github.ref_name }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11 # Change this to whatever version the program is being developed on
- name: flake8 install
id: pip-flake8
run: pip install flake8
- name: Run flake8
id: flake8
run: flake8
- name: Fix using autopep8 on pushes
id: autopep8
if: ${{ github.event_name == 'push' }}
run: |
pip install autopep8
autopep8 --in-place .
- name: Commit changes
id: commit
if: ${{ steps.autopep8.outcome == 'success' }}
run: |
git config user.name GitHub Actions
git config user.email actions@github.com
git add .
git commit -m "chore: run autopep8 on ${{ github.sha }}"
git push