File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 2020 steps :
2121 - name : Checkout
2222 uses : actions/checkout@v4
23+ with :
24+ fetch-depth : ${{ github.event_name == 'pull_request' && 2 || 0 }}
2325
2426 - name : Setup PHP
2527 uses : shivammathur/setup-php@v2
2931 - name : Install Composer dependencies
3032 uses : ramsey/composer-install@v3
3133
34+ - name : Get changed files
35+ id : changed-files
36+ run : |
37+ if ${{ github.event_name == 'pull_request' }}; then
38+ echo "all_changed_and_modified_files=$(git diff --name-only --diff-filter=ACMRTUXB -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
39+ else
40+ echo "all_changed_and_modified_files=$(git diff --name-only --diff-filter=ACMRTUXB ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
41+ fi
42+
3243 - name : PHP CS Fixer
33- run : vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --diff --using-cache=no
44+ run : |
45+ CHANGED_FILES=$(echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}" | tr ' ' '\n')
46+ 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
47+ vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php -v --dry-run --diff --using-cache=no ${EXTRA_ARGS}
3448 env :
3549 PHP_CS_FIXER_IGNORE_ENV : ${{ matrix.php-versions == '8.4' && '1' || '' }}
You can’t perform that action at this time.
0 commit comments