Skip to content

refactor: update CI and switch some tooling to Laravel ecosystem #109

refactor: update CI and switch some tooling to Laravel ecosystem

refactor: update CI and switch some tooling to Laravel ecosystem #109

name: Verify code formatting
on:
pull_request:
branches:
- develop
- master
push:
branches:
- develop
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
jobs:
test-formatting:
name: Auto-format code using php-cs-fixer
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
- name: Install NodeJS dependencies
run: npm install --verbose --foreground-scripts
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: exif,json,mbstring
coverage: none
- name: Configure local Laravel Nova dummy package
run: |
composer config repositories.0 path ./tests/Fixtures/nova
git update-index --assume-unchanged composer.json
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
- name: Lint code
run: |
composer run format
npm run format
- name: Report changes
id: report-changes
run: |
git diff --color=always
echo " > git diff --shortstat" >> $GITHUB_STEP_SUMMARY
echo " $( git diff --shortstat )" >> $GITHUB_STEP_SUMMARY
echo "HAS_CHANGES=$( git diff --quiet && echo 'no' || echo 'yes' )" >> $GITHUB_OUTPUT
- name: Fail on changes (pull request only)
if: ${{ github.event_name == 'pull_request' && steps.report-changes.outputs.HAS_CHANGES == 'yes' }}
run: |
echo '::error title=Linting caused changes::Some files were modified by the linter, please run `composer format` to fix these'
exit 1
- name: Commit changes (push only)
if: github.event_name == 'push'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message:' chore: fixed code formatting issues'