-
Notifications
You must be signed in to change notification settings - Fork 255
34 lines (30 loc) · 1.15 KB
/
php-cs-fixer.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
on:
push:
branches:
- release-2.1
pull_request:
name: PHP Check
jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
files: '*.php'
- name: Get extra arguments for PHP-CS-Fixer
id: phpcs-intersection
run: |
CHANGED_FILES=$(echo "${{ steps.changed-files.outputs.all_changed_files_count }}" | tr ' ' '\n')
if echo "${CHANGED_FILES}" eq "1"; then CHANGED_FILES=""; fi
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
echo "PHPCS_EXTRA_ARGS<<EOF" >> $GITHUB_ENV
echo "$EXTRA_ARGS" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php -v --dry-run --stop-on-violation --using-cache=no ${{ env.PHPCS_EXTRA_ARGS }}