From b7186f049990b9bdb59e5ee2d871c5d31f05a92f Mon Sep 17 00:00:00 2001 From: erikn69 Date: Fri, 24 Jan 2025 12:47:58 -0500 Subject: [PATCH] Pint --diff arg --- README.md | 5 +++-- action.yml | 4 ++++ entrypoint.sh | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d363781..5a1de1a 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ GitHub Action implementation of the [Laravel Pint](https://github.com/laravel/pi Use with [GitHub Actions](https://github.com/features/actions) -_.github/workflows/pint.yml +`_.github/workflows/pint.yml` -``` +```yml name: PHP Linting on: pull_request jobs: @@ -25,6 +25,7 @@ jobs: configPath: "vendor/my-company/coding-style/pint.json" pintVersion: 1.8.0 onlyDirty: true + # onlyDiff: "origin/main" ``` ℹ️ Starting from version 2 you can specify the Pint version to be used by specifying a `pintVersion` in your configuration file. diff --git a/action.yml b/action.yml index be1be9d..1a60611 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,10 @@ inputs: onlyDirty: description: "only format changed files" required: false + + onlyDiff: + description: "only format changed files that differ from the provided branch" + required: false pintVersion: description: "laravel/pint composer version to install a specific version." diff --git a/entrypoint.sh b/entrypoint.sh index 8bac46f..9a8c50f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -31,6 +31,11 @@ if [[ "${INPUT_PRESET}" ]]; then pint_command+=" --preset ${INPUT_PRESET}" fi +if [[ "${INPUT_ONLYDIFF}" ]]; then + pint_command+=" --diff=${INPUT_ONLYDIFF}" + INPUT_ONLYDIRTY=false +fi + if [[ "${INPUT_ONLYDIRTY}" == true ]]; then pint_command+=" --dirty" fi