Skip to content

Commit d78fc07

Browse files
committed
Adding code quality check for a PR.
1 parent 4d398bc commit d78fc07

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/code-quality.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Code Quality
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'plugins/**'
7+
8+
jobs:
9+
run:
10+
runs-on: ubuntu-latest
11+
name: Check code quality
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Get changed plugin directory
18+
id: plugin
19+
run: |
20+
git fetch --prune --unshallow
21+
plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/' | head -1 | cut -d/ -f2)
22+
echo "slug=$plugin" >> $GITHUB_OUTPUT
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: '7.4'
28+
tools: composer:v2
29+
coverage: none
30+
31+
- name: Install dependencies
32+
uses: ramsey/composer-install@v2
33+
with:
34+
composer-options: "--no-progress"
35+
36+
- name: Run PHP CodeSniffer
37+
working-directory: plugins/${{ steps.plugin.outputs.slug }}
38+
run: composer run-script phpcs
39+
40+
- name: Run PHPStan
41+
working-directory: plugins/${{ steps.plugin.outputs.slug }}
42+
run: composer run-script phpstan
43+
44+
- name: Run Psalm
45+
working-directory: plugins/${{ steps.plugin.outputs.slug }}
46+
run: composer run-script psalm

0 commit comments

Comments
 (0)