Skip to content

Commit

Permalink
ci: add pint fix and lint actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rrelmy committed Nov 7, 2024
1 parent 01c1bb0 commit 7a51aad
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pint-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Fix PHP code style issues

on:
push:
paths:
- '**.php'

permissions:
contents: write

jobs:
fix-php-code-styling:
runs-on: ubuntu-latest
if: github.repository_owner == 'statamic'

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.PINT }}

- name: Fix PHP code style issues
uses: aglipanci/laravel-pint-action@v2
with:
pintVersion: 1.16.0

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Fix styling
21 changes: 21 additions & 0 deletions .github/workflows/pint-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint PHP code style issues

on:
pull_request:
paths:
- '**.php'

jobs:
lint-php-code-styling:
runs-on: ubuntu-latest

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

- name: Check PHP code style issues
uses: aglipanci/laravel-pint-action@v2
with:
testMode: true
verboseMode: true
pintVersion: 1.16.0
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,13 @@
"AppsWithLove\\Statamic\\CharField\\ServiceProvider"
]
}
},
"require-dev": {
"laravel/pint": "^1.18"
},
"config": {
"allow-plugins": {
"pixelfear/composer-dist-plugin": true
}
}
}
21 changes: 21 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"preset": "laravel",
"rules": {
"binary_operator_spaces": {
"default": "single_space",
"operators": {
"=>": null
}
},
"class_attributes_separation": {
"elements": {
"method": "one"
}
},
"class_definition": {
"multi_line_extends_each_single_line": true,
"single_item_single_line": true
},
"psr_autoloading": true
}
}

0 comments on commit 7a51aad

Please sign in to comment.