Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Run PHP Insights in Github Actions

License

Notifications You must be signed in to change notification settings

stefanzweifel/phpinsights-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpinsights-action

Warning

This Action has been archived.
If you want to run phpinsights in your project, you can achieve this by using a simple workflow like this.

name: PHP Insights
on: push
jobs:
  phpinsights:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3

    - uses: shivammathur/setup-php@v2

    - uses: ramsey/composer-install@v3

    - name: Run phpinsights
      run: ./vendor/bin/phpinsights -n

This GitHub Action executes phpinsights. The output of the Insights Command can be viewed in the Actions log.

You can optionally define minimum values for Insights categories. If the value falls below your given threshold, the run fails.

If you're using Laravel, there's also a framework specific Action available.

Usage

This Action doesn't install composer dependencies on it's own and doesn't contain a phpinsights binary.

It's therefore required that phpinsights is set as a dependency in your project and that another Action installs the composer dependencies.

An example Workflow can look like this.

name: PHP Insights

on: push

jobs:
  phpinsights:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1

    - uses: MilesChou/composer-action@master
      with:
        args: install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist

    - uses: stefanzweifel/[email protected]

Arguments

You can pass any valid phpinsights argument to the Action. In this example, all issues are always displayed and a minimum value of 80 has to be achieved in all categories.

name: PHP Insights

on: push

jobs:
  phpinsights:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1

    - uses: MilesChou/composer-action@master
      with:
        args: install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist

    - uses: stefanzweifel/[email protected]
      with:
        args: -v --min-quality=80 --min-complexity=80 --min-architecture=80 --min-style=80 --disable-security-check

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.