GitHub Action for the Laravel Pint Package. Also, annotation based on a Checkstyle XML-report is available.
Use with GitHub Actions
name: PHP Lint
on:
push:
branches:
- master
pull_request:
branches-ignore:
- 'dependabot/npm_and_yarn/*'
- 'dependabot/composer/*'
schedule:
- cron: '0 0 * * *'
jobs:
phplint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
- name: Run Laravel Pint
uses: sergotail/laravel-pint-action@v2
with:
onlyFiles: ${{ steps.changed-files.outputs.all_changed_files }}
testMode: true
verboseMode: true
configPath: ./pint.json
preset: laravel
onlyDirty: false
annotate: true
pintVersion: 1.8.0
annotateVersion: 1.8.5
useComposer: true
ℹ️ Also you can specify the Pint version to be used by specifying a pintVersion
in your configuration file.
Even when useComposer
is endabled, pintVersion
and annotateVersion
are checked first, and only then the lock file is checked.
annotate
option uses annotate-pull-request-from-checkstyle package to annotate pull request based on a Checkstyle XML-report. When annotation is enabled, pint is running in test mode.
This action DOESN'T commit changes automatically. If you want to achieve such behaviour you have to use it in combination with another action like git-auto-commit Action or Create Pull Request Action. Note that in this case you have to disable testMode
.