Skip to content

Commit 05ee02c

Browse files
Merge pull request #33 from SomethingGeneric/copilot/add-pylint-and-black-job
Add CI workflow for pylint (8/10 threshold) and auto-formatting with black
2 parents 5059d7f + 63a0dce commit 05ee02c

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/lint.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
pylint:
11+
name: Pylint
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install pylint
27+
pip install -r requirements.txt
28+
29+
- name: Run Pylint
30+
run: |
31+
pylint miniupdate/ setup.py --fail-under=8.0
32+
33+
black:
34+
name: Black Formatter
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: write
38+
# Skip if the last commit was from github-actions[bot] to avoid infinite loops
39+
if: github.actor != 'github-actions[bot]'
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
ref: ${{ github.head_ref || github.ref }}
45+
46+
- name: Set up Python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: '3.11'
50+
51+
- name: Install Black
52+
run: |
53+
python -m pip install --upgrade pip
54+
pip install black
55+
56+
- name: Run Black
57+
run: |
58+
black miniupdate/ setup.py
59+
60+
- name: Check for changes
61+
id: verify_diff
62+
run: |
63+
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
64+
65+
- name: Commit and push changes
66+
if: steps.verify_diff.outputs.changed == 'true'
67+
run: |
68+
git config user.name "github-actions[bot]"
69+
git config user.email "github-actions[bot]@users.noreply.github.com"
70+
git add .
71+
git commit -m "Apply black formatting"
72+
git push

0 commit comments

Comments
 (0)