diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..42a68b6 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,20 @@ +# Lints only the files a PR changes, using this repo's own phpcs.xml / ESLint config. +# Logic lives in themegrill/workflows (lint.yml); see that repo for inputs. +name: Lint + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - '**.php' + - '**.js' + - '**.jsx' + - '**.ts' + - '**.tsx' + - '.github/workflows/lint.yml' + +jobs: + lint: + uses: themegrill/workflows/.github/workflows/lint.yml@master + with: + php-version: '7.4' diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml deleted file mode 100644 index 7400a93..0000000 --- a/.github/workflows/phpcs.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: PHPCS - -on: - pull_request: - paths: - - '**.php' - -jobs: - phpcs: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '7.4' - tools: composer - - - name: Get changed PHP files - id: changed-files - uses: tj-actions/changed-files@v45 - with: - files: '**.php' - separator: ' ' - - - name: Install Composer dependencies - if: steps.changed-files.outputs.any_changed == 'true' - run: composer install --no-interaction --no-progress - - - name: Run PHPCS on changed files - if: steps.changed-files.outputs.any_changed == 'true' - env: - PHP_FILES: ${{ steps.changed-files.outputs.added_files }} ${{ steps.changed-files.outputs.copied_files }} ${{ steps.changed-files.outputs.modified_files }} ${{ steps.changed-files.outputs.renamed_files }} - run: | - if [ -n "$(echo "$PHP_FILES" | xargs)" ]; then - composer phpcs -- $PHP_FILES - else - echo "No existing PHP files to lint (only deletions in this PR)." - fi