-
Notifications
You must be signed in to change notification settings - Fork 8
67 lines (58 loc) · 1.77 KB
/
quality-report.yml
File metadata and controls
67 lines (58 loc) · 1.77 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
name: Code Quality Report
on:
pull_request:
branches: [main]
jobs:
quality-report:
name: Generate Quality Report
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff
- name: Run Black check
run: black --check . 2>&1 | tee black-output.txt || true
- name: Run Ruff check
run: ruff check . 2>&1 | tee ruff-output.txt || true
- name: Generate summary report
run: |
{
echo "## Code Quality Report"
echo ""
echo "### Black Formatting"
if grep -q "would reformat" black-output.txt; then
echo "❌ Some files need formatting"
else
echo "✅ All files are properly formatted"
fi
echo ""
echo "### Ruff Linting"
if [ -s ruff-output.txt ]; then
echo "❌ Linting issues found:"
cat ruff-output.txt
else
echo "✅ No linting issues"
fi
} > report.md
- name: Comment PR with report
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('report.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: report
});