Fix #29
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: PHPCS on Push | |
on: | |
push: | |
branches: | |
- '*' | |
jobs: | |
phpcs: | |
name: Run PHPCS | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Set up PHP with Composer | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' # Specify the version of PHP you want to use | |
tools: composer, phpcs | |
# Install Composer dependencies, including dev dependencies | |
- name: Install Composer dependencies | |
run: composer install --no-progress --prefer-dist --no-interaction | |
# Run PHPCS (PHP CodeSniffer) to check code standards | |
- name: Run PHP CodeSniffer | |
run: vendor/bin/phpcs -ps . | |
# Optional: Fail the workflow if PHPCS finds issues | |
- name: Fail if issues found | |
run: | | |
if [ $(vendor/bin/phpcs --report=summary . | grep -c "FOUND") -gt 0 ]; then | |
echo "PHPCS found issues, failing the job." | |
exit 1 | |
fi |