-
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (117 loc) · 3.88 KB
/
Copy pathcode-quality.yml
File metadata and controls
144 lines (117 loc) · 3.88 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Code Quality & Auto-Fix
on:
push:
branches: [ universe, main ]
pull_request:
branches: [ universe, main ]
jobs:
php-quality:
name: PHP Code Quality
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f
with:
php-version: '8.3'
tools: composer:v2
coverage: none
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install PHP dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Run PHPCS
run: composer phpcs || true
- name: Run PHPStan
run: composer phpstan || true
- name: Run Rector (dry-run)
run: composer rector || true
js-quality:
name: JavaScript/CSS Code Quality
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
with:
version: 8.6.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install Node dependencies
run: pnpm install --frozen-lockfile
- name: Run ESLint
env:
ESLINT_USE_FLAT_CONFIG: "false"
run: pnpm run lint:js || true
- name: Run Stylelint
run: pnpm run lint:css || true
auto-fix:
name: Auto-Fix Code Issues
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/universe'
needs: [php-quality, js-quality]
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f
with:
php-version: '8.3'
tools: composer:v2
- name: Setup pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
with:
version: 8.6.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: |
composer install --prefer-dist --no-interaction
pnpm install --frozen-lockfile
- name: Run Rector fixes
run: composer rector:fix || true
- name: Run PHP CS Fixer
run: composer phpfix || true
- name: Run PHPCBF
run: composer phpcbf || true
- name: Run ESLint fixes
env:
ESLINT_USE_FLAT_CONFIG: "false"
run: pnpm run lint:fix || true
- name: Run Stylelint fixes
run: pnpm run stylelint:fix || true
- name: Run Prettier
run: pnpm run format || true
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3
with:
commit_message: "style: auto-fix code quality issues [skip ci]"
commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com"
branch: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
file_pattern: "src/**/*.php src/**/*.js src/**/*.css"