-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (34 loc) · 1.12 KB
/
phpcs.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
name: PHPCS
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
phpcs:
name: PHP CS Fixer
runs-on: ubuntu-latest
strategy:
matrix:
php-versions:
- '8.2'
- '8.3'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
- name: PHP CS Fixer
run: |
CHANGED_FILES=$(echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}" | tr ' ' '\n')
if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php-cs-fixer(\\.dist)?\\.php|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi
PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --diff --using-cache=no ${EXTRA_ARGS}