Skip to content

Commit 1472844

Browse files
Edgaraszsnunomadurotaylorotwell
authored
[11.x] Adds documentation on GitHub Actions with Laravel Pint (#9661)
* docs: laravel pint usage with github actions * Fixes Pint documentation with GitHub Actions * Update pint.md --------- Co-authored-by: Nuno Maduro <enunomaduro@gmail.com> Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent bdf7135 commit 1472844

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

pint.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- [Presets](#presets)
88
- [Rules](#rules)
99
- [Excluding Files / Folders](#excluding-files-or-folders)
10+
- [Continuous Integration](#continuous-integration)
11+
- [GitHub Actions](#running-tests-on-github-actions)
1012

1113
<a name="introduction"></a>
1214
## Introduction
@@ -156,3 +158,47 @@ If you would like to exclude a file by providing an exact path to the file, you
156158
]
157159
}
158160
```
161+
162+
<a name="continuous-integration"></a>
163+
## Continuous Integration
164+
165+
<a name="running-tests-on-github-actions"></a>
166+
### GitHub Actions
167+
168+
To automate linting your project with Laravel Pint, you can configure [GitHub Actions](https://github.com/features/actions) to run Pint whenever new code is pushed to GitHub. First, be sure to grant "Read and write permissions" to workflows within GitHub at **Settings > Actions > General > Workflow permissions**. Then, create a `.github/workflows/lint.yml` file with the following content:
169+
170+
```yaml
171+
name: Fix Code Style
172+
173+
on: [push]
174+
175+
jobs:
176+
lint:
177+
runs-on: ubuntu-latest
178+
strategy:
179+
fail-fast: true
180+
matrix:
181+
php: [8.3]
182+
183+
steps:
184+
- name: Checkout code
185+
uses: actions/checkout@v4
186+
187+
- name: Setup PHP
188+
uses: shivammathur/setup-php@v2
189+
with:
190+
php-version: ${{ matrix.php }}
191+
extensions: json, dom, curl, libxml, mbstring
192+
coverage: none
193+
194+
- name: Install Pint
195+
run: composer global require laravel/pint
196+
197+
- name: Run Pint
198+
run: pint
199+
200+
- name: Commit linted files
201+
uses: stefanzweifel/git-auto-commit-action@v5
202+
with:
203+
commit_message: "Fixes coding style"
204+
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy