Skip to content

Commit

Permalink
Pint --diff arg
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 committed Jan 24, 2025
1 parent 80d3ca3 commit b7186f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b7186f0

Please sign in to comment.