php-parallel-lint/PHP-Parallel-Lint

Github Actions output

boesing opened this issue · 2 comments

Is your feature request related to a problem?

Nope. I just wonder if there is an option to have GHA output to highlight Pull Request files.

Describe the solution you'd like

Several tools, such as PHPStan, Psalm, etc. are offering in-build github output so that Github Action jobs are highlighting files within the Pull Request. It seems that this tool has gitlab output, so might be helpful to have an output for github as well.

Additional context (optional)

  • I might create a pull request to implement this feature, depends on when I find time for it.
jrfnl commented

This is already possible via cs2pr - see the example here: https://github.com/staabm/annotate-pull-request-from-checkstyle#using-php-parallel-lint

To use this, typically the workflow would look something like this:

jobs:
  lint:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php: ['8.0', 'latest', 'nightly']

    name: "Lint: PHP ${{ matrix.php }}"
    continue-on-error: ${{ matrix.php == 'nightly' }}

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          ini-values: error_reporting=-1, display_errors=On, log_errors_max_len=0
          coverage: none
          tools: cs2pr # <= This is important!

      - name: Install Composer dependencies
        uses: "ramsey/composer-install@v3"

      - name: Lint against parse errors
        run: composer lint -- --checkstyle | cs2pr # <= And this too ;-)

Ah I see, thanks! That indeed works for me.