Add phpcbf check workflow #13
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
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 |