Skip to content

Add phpcbf check workflow #13

Add phpcbf check workflow

Add phpcbf check workflow #13

Workflow file for this run

name: PHP Code Beautifier Check
on:
push:
paths-ignore:
- '**.md'
- '**.txt'
- '**.yml'
pull_request:
workflow_dispatch:
jobs:
phpcbf:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1' # Adjust this to your PHP version
extensions: uopz
- name: Install PHP_CodeSniffer
run: composer install --prefer-dist --no-progress --ignore-platform-reqs
- name: Run phpcbf
id: cbf
continue-on-error: true
run: |
./vendor/bin/phpcbf -q --parallel=1 src templates assets
# report-phpcbf:
# needs: phpcbf
# if: ${{ always() && contains(needs.*.result, 'failure') }}
# runs-on: ubuntu-latest
# steps:
- name: Find Comment
if: steps.cbf.outcome == 'failure'
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: PHP Code Beautifier and Fixer found the following fixable issues
- name: Create or update comment
if: steps.cbf.outcome == 'failure'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
PHP Code Beautifier and Fixer found the following fixable issues, fix them first to ammend to contribution guidelines.
edit-mode: replace