Performance debugger #98
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PHP-CS-Fixer (PR & Push) | |
| on: | |
| pull_request: | |
| paths: ["**.php"] | |
| push: | |
| branches: [early, main] | |
| paths: ["**.php"] | |
| jobs: | |
| phpcs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1) исходники | |
| - uses: actions/checkout@v4 | |
| # 2) кэш самого фиксатора | |
| - uses: actions/cache@v3 | |
| with: | |
| path: .php-cs-fixer.cache | |
| key: php-cs-fixer-${{ runner.os }}-${{ github.sha }} | |
| restore-keys: | | |
| php-cs-fixer- | |
| # 3) список реально изменённых файлов (только в PR) | |
| - name: Get changed files | |
| id: changed | |
| if: github.event_name == 'pull_request' | |
| uses: tj-actions/changed-files@v38 | |
| # 4) формируем аргументы (--path-mode=intersection) | |
| - name: Build args | |
| id: args | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| FILES=$(echo "${{ steps.changed.outputs.all_changed_files }}" | tr ' ' '\n' | grep '\.php$' || true) | |
| if [ -n "$FILES" ]; then | |
| echo "args=--path-mode=intersection -- ${FILES}" >> $GITHUB_OUTPUT | |
| fi | |
| fi | |
| # 5) запуск фиксатора через готовую action | |
| - name: PHP-CS-Fixer (dry-run) | |
| uses: docker://oskarstark/php-cs-fixer-ga | |
| with: | |
| args: >- | |
| --config=.php-cs-fixer.php | |
| --diff --dry-run --verbose | |
| --using-cache=yes | |
| ${{ steps.args.outputs.args }} | |
| continue-on-error: true # exit-код 8 → предупреждение |