├── CHANGELOG.md ├── Dockerfile ├── LICENSE ├── README.md ├── action.yml └── entrypoint.sh /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 6 | 7 | ## [Unreleased](https://github.com/stefanzweifel/phpinsights-action/compare/v1.1.1...HEAD) 8 | 9 | ## [v1.1.1](https://github.com/stefanzweifel/phpinsights-action/compare/v1.1.0...v1.1.1) - 2020-02-11 10 | 11 | ### Changed 12 | - Run phpinsights with PHP 7.4 (https://github.com/stefanzweifel/phpinsights-action/commit/f2ee5617ced1f2edd89ed777d302a9ef845cc434) 13 | 14 | 15 | ## [v1.1.0](https://github.com/stefanzweifel/phpinsights-action/compare/v1.0.0...v1.1.0) - 2020-02-09 16 | 17 | ### Added 18 | - Add `action.yml` [#1](https://github.com/stefanzweifel/phpinsights-action/pull/1) 19 | 20 | ## v1.0.0 - 2019-06-10 21 | 22 | ### Added 23 | 24 | - Add Core Logic for Action 25 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.4.2-cli-alpine 2 | 3 | LABEL "com.github.actions.name"="PHP Insights Action" 4 | LABEL "com.github.actions.description"="Run PHP Insights" 5 | LABEL "com.github.actions.icon"="bar-chart-2" 6 | LABEL "com.github.actions.color"="blue" 7 | 8 | LABEL "repository"="http://github.com/stefanzweifel/phpinsights-action" 9 | LABEL "homepage"="http://github.com/stefanzweifel/phpinsights-action" 10 | LABEL "maintainer"="Stefan Zweifel " 11 | 12 | # fix work iconv library with alphine 13 | # https://github.com/nunomaduro/phpinsights/issues/43#issuecomment-498108857 14 | RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ --allow-untrusted gnu-libiconv 15 | ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php 16 | 17 | COPY entrypoint.sh /usr/local/bin/entrypoint.sh 18 | 19 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Stefan Zweifel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # phpinsights-action 2 | 3 | > [!WARNING] 4 | > This Action has been archived. 5 | > If you want to run [phpinsights](https://github.com/nunomaduro/phpinsights) in your project, you can achieve this by using a simple workflow like this. 6 | 7 | ```yaml 8 | name: PHP Insights 9 | on: push 10 | jobs: 11 | phpinsights: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - uses: shivammathur/setup-php@v2 17 | 18 | - uses: ramsey/composer-install@v3 19 | 20 | - name: Run phpinsights 21 | run: ./vendor/bin/phpinsights -n 22 | ``` 23 | 24 | This GitHub Action executes [phpinsights](https://github.com/nunomaduro/phpinsights). The output of the Insights Command can be viewed in the Actions log. 25 | 26 | You can optionally define minimum values for Insights categories. If the value falls below your given threshold, the run fails. 27 | 28 | If you're using Laravel, there's also [a framework specific Action](https://github.com/stefanzweifel/laravel-phpinsights-action) available. 29 | 30 | ### Usage 31 | 32 | This Action doesn't install composer dependencies on it's own and doesn't contain a `phpinsights` binary. 33 | 34 | It's therefore required that `phpinsights` is set as a dependency in your project and that another Action installs the composer dependencies. 35 | 36 | An example Workflow can look like this. 37 | 38 | 39 | ```yaml 40 | name: PHP Insights 41 | 42 | on: push 43 | 44 | jobs: 45 | phpinsights: 46 | runs-on: ubuntu-latest 47 | steps: 48 | - uses: actions/checkout@v1 49 | 50 | - uses: MilesChou/composer-action@master 51 | with: 52 | args: install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist 53 | 54 | - uses: stefanzweifel/phpinsights-action@v1.1.1 55 | ``` 56 | 57 | 58 | ### Arguments 59 | 60 | 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. 61 | 62 | ```yaml 63 | name: PHP Insights 64 | 65 | on: push 66 | 67 | jobs: 68 | phpinsights: 69 | runs-on: ubuntu-latest 70 | steps: 71 | - uses: actions/checkout@v1 72 | 73 | - uses: MilesChou/composer-action@master 74 | with: 75 | args: install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist 76 | 77 | - uses: stefanzweifel/phpinsights-action@v1.1.1 78 | with: 79 | args: -v --min-quality=80 --min-complexity=80 --min-architecture=80 --min-style=80 --disable-security-check 80 | ``` 81 | 82 | ## Versioning 83 | 84 | We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/stefanzweifel/phpinsights-action/tags). 85 | 86 | ## License 87 | 88 | This project is licensed under the MIT License - see the [LICENSE](https://github.com/stefanzweifel/phpinsights-action/blob/master/LICENSE) file for details. 89 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: PHP Insights Action 2 | description: Run PHP Insights 3 | 4 | author: Stefan Zweifel 5 | 6 | runs: 7 | using: 'docker' 8 | image: 'Dockerfile' 9 | 10 | branding: 11 | icon: bar-chart-2 12 | color: blue 13 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | ./vendor/bin/phpinsights -n $* 6 | --------------------------------------------------------------------------------