Skip to content

Setup linting scripts and fix basic linting #1

Setup linting scripts and fix basic linting

Setup linting scripts and fix basic linting #1

Workflow file for this run

name: lint
on:
pull_request:
paths:
- "**.php"
jobs:
lint:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Setup Composer
uses: ramsey/composer-install@v3
with:
composer-options: "--no-scripts"
- name: Setup Reviewdog
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: Collect changed files
id: changed-files
uses: tj-actions/changed-files@v46
with:
files: |
**.php
files_ignore: |
vendor/*
- name: Run phpcs and filter through reviewdog
if: steps.changed-files.outputs.any_changed == 'true'
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./vendor/bin/phpcs --report=checkstyle ${{ steps.changed-files.outputs.all_changed_files }} | reviewdog -f=checkstyle -reporter=github-pr-annotations -filter-mode=added -name=phpcs
- name: Run phpstan and filter through reviewdog
if: steps.changed-files.outputs.any_changed == 'true' && (success() || failure())
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./vendor/bin/phpstan analyse --no-progress --configuration=phpstan.neon --error-format=checkstyle ${{ steps.changed-files.outputs.all_changed_files }} | reviewdog -f=checkstyle -reporter=github-pr-annotations -filter-mode=added -name=phpstan