Skip to content

GitHub action for installing PHPStan in workflows.

License

Notifications You must be signed in to change notification settings

NxtLvLSoftware/setup-phpstan-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Action nxtlvlsoftware/setup-phpstan-action

GitHub action for installing PHPStan in actions workflows.

  • Allows passing version string and installing from github releases into path/env.
  • Allows passing existing executable path and installing into path/env.
  • Supports caching for version string and existing binary installations.
Action Input Required Default Description
install-path true The path to install PHPStan binary to.
version false latest The target PHPStan version to install. Exact versions only (8.0.11, 7.4.24, etc.)
path false false Path to an existing PHPStan installation.

Either version or path must be specified.

How to use

Attempt to download any PHPStan release by providing the version:

name: My PHPStan Workflow
on: [push]
jobs:
  setup-phpstan:
    name: Setup PHPStan
    runs-on: ubuntu-latest
    steps:
      - uses: nxtlvlsoftware/setup-phpstan-action@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          version: '1.8.2'
          install-path: './bin'

Forwarding the $GIHUB_TOKEN environment variable is required to properly configure PHPStan as we interact with the GitHub API to fetch version information.

Or provide the path to an existing PHPStan installation/binary:

name: My PHPStan Workflow
on: [push]
jobs:
  setup-phpstan:
    name: Setup PHPStan
    runs-on: ubuntu-latest
    steps:
      - uses: nxtlvlsoftware/setup-phpstan-action@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          path: 'path/to/your/phpstan.phar'
          install-path: './bin'

License

nxtlvlsoftware/setup-phpstan-action is open-sourced software licensed under the MIT license.