-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (40 loc) · 1.36 KB
/
lint.yml
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: Lint
on:
pull_request:
env:
PHP_VERSION: 8.2
TERM: xterm
jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: "actions/checkout@v4"
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
files: "{docroot,web}/{modules,themes}/custom/**/*.{php,module,inc,install,test,profile,theme,yml}"
files_ignore: |
*Test.php
*TestBase.php
**/tests/
- name: Set up PHP
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ env.PHP_VERSION }}"
tools: "cs2pr, phpcs, composer"
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
- name: Install Drupal Coder
run: |
composer global config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer global require --ignore-platform-reqs drupal/coder
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
- name: PHPCS
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
phpcs -q --report=checkstyle --standard=Drupal,DrupalPractice -n $file | cs2pr
done
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}