-
-
Notifications
You must be signed in to change notification settings - Fork 73
48 lines (40 loc) · 1.2 KB
/
code-quality-score.yml
File metadata and controls
48 lines (40 loc) · 1.2 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: Code Quality Scoring
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'src/**.ts'
- 'src/**.tsx'
- '.github/scripts/**'
- '.eslintrc*'
- 'package.json'
- 'tsconfig.json'
jobs:
score-code-quality:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run ESLint and generate report
run: npx eslint src --ext .ts,.tsx -f json -o eslint-report.json || true
- name: Score the code
run: node .github/scripts/scoreCode.js
- name: Comment Code Score on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('score-output.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body
});