Skip to content

Improve workflow

Improve workflow #1

Workflow file for this run

name: PHPStan
on:
pull_request:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-24.04
env:
php-version: '8.2'
steps:
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
ini-values: "memory_limit=-1"
coverage: none
-
name: Checkout target branch
uses: actions/checkout@v6
with:
ref: ${{ github.base_ref }}
-
name: Checkout PR
uses: actions/checkout@v6
-
name: Install dependencies
run: |
COMPOSER_HOME="$(composer config home)"
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
composer install --no-progress --ansi --no-plugins
-
name: Generate PHPStan baseline
run: |
git checkout composer.json
git checkout -m ${{ github.base_ref }}
vendor/bin/phpstan analyze --generate-baseline --allow-empty-baseline --no-progress
git checkout -m FETCH_HEAD
-
name: PHPStan
run: |
vendor/bin/phpstan analyze --no-progress --error-format=github