Last active
December 23, 2022 15:20
-
-
Save janyksteenbeek/d95514fbdea53830612202312799b4fa to your computer and use it in GitHub Desktop.
Run Laravel Pint on PRs towards `main` with GitHub Actions and auto-commit changes (.github/workflows/laravel-pint.yml)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .github/workflows/laravel-pint.yml | |
# -- Be sure to add `laravel/pint` to your require-dev in your composer.json | |
name: Format Code using Laravel Pint | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
pint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Install Composer dependancies | |
run: composer install | |
env: | |
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{secrets.COMPOSER_TOKEN}}"} }' # Only needed with private packages. Add a `COMPOSER_TOKEN` secret to your Github Actions settings using a GitHub PAT (https://github.com/settings/tokens/new?scopes=repo&description=Token+for+GH+actions+runner - mind the expiration date) | |
- name: Run Laravel Pint | |
run: ./vendor/bin/pint | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "[pint] Apply Laravel Pint code-style fixes" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment