Coding Standards #365
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
### | |
# | |
# This workflow file is deployed into this repository via the "Sync Organization Files" workflow | |
# | |
# Direct edits to this file are at risk of being overwritten by the next sync. All edits should be made | |
# to the source file. | |
# | |
# @see Sync workflow {@link https://github.com/gocodebox/.github/actions/workflows/workflow-sync.yml} | |
# @see Workflow template {@link https://github.com/gocodebox/.github/blob/trunk/.github/workflow-templates/coding-standards.yml} | |
# | |
### | |
name: Coding Standards | |
on: | |
workflow_dispatch: | |
pull_request: | |
# Once daily at 00:00 UTC. | |
schedule: | |
- cron: '0 0 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ 'pull_request' == github.event_name && github.head_ref || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
phpcs: | |
name: Check Coding Standards | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.0' | |
coverage: none | |
tools: composer, cs2pr | |
# Composer Install. | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer dependencies | |
run: composer update | |
# Check Coding Standards. | |
- name: Run PHPCS | |
run: composer run check-cs-errors -- --report-full --report-checkstyle=./phpcs-report.xml | |
- name: Show PHPCS results in PR | |
run: cs2pr ./phpcs-report.xml |