-
Notifications
You must be signed in to change notification settings - Fork 115
47 lines (40 loc) · 1.31 KB
/
pr_validation.yml
File metadata and controls
47 lines (40 loc) · 1.31 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
name: Pull Request Validation
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
pr-checks:
name: PR Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Check PR Title
run: |
TITLE="${{ github.event.pull_request.title }}"
echo "PR Title: $TITLE"
if [[ ! "$TITLE" =~ ^(feat|fix|docs|refactor|test|chore|ci): ]]; then
echo "ERROR: Invalid title format"
echo "Use format: type: description"
echo "Valid types: feat, fix, docs, refactor, test, chore, ci"
exit 1
fi
echo "Title format valid"
- name: Install Flake8
run: pip install flake8
- name: Check Python Code Quality
run: |
FILES=$(git diff --name-only --diff-filter=AM origin/${{ github.base_ref }}...HEAD | grep '\.py$' || true)
if [ -z "$FILES" ]; then
echo "No Python files changed"
exit 0
fi
echo "Checking Python files"
echo "$FILES" | xargs flake8 --select=E9,F63,F7,F82 --show-source
echo "Quality check passed"