-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve: Improve workflows for coding standards
- Loading branch information
Showing
3 changed files
with
114 additions
and
44 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,57 @@ | ||
name: WordPress PHPCS Coding Standards Autofixer | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- '**.php' | ||
pull_request: | ||
branches-ignore: | ||
# Do not run on auto submitted branches | ||
- '**-phpcbf' | ||
- 'dependabot/' | ||
- 'renovate/' | ||
paths: | ||
- '**.php' | ||
|
||
name: WordPress Autofixer | ||
|
||
jobs: | ||
phpcbf-fixer: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
phpcbf-fixer: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
coverage: none | ||
tools: cs2pr | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
coverage: none | ||
tools: cs2pr | ||
|
||
# Install dependencies and handle caching in one go. | ||
# @link https://github.com/marketplace/actions/install-composer-dependencies | ||
- name: Install Composer dependencies | ||
uses: "ramsey/composer-install@v1" | ||
# Install dependencies and handle caching in one go. | ||
# @link https://github.com/marketplace/actions/install-composer-dependencies | ||
- name: Install Composer dependencies | ||
uses: "ramsey/composer-install@v1" | ||
|
||
# Check the code-style consistency of the PHP files. | ||
- name: Fix PHP code style | ||
continue-on-error: true | ||
run: ./vendor/squizlabs/php_codesniffer/bin/phpcbf -p -v --standard=${{ github.workspace }}/phpcs.xml --extensions=php ${{ github.workspace }}/ | ||
# Check the code-style consistency of the PHP files. | ||
- name: Fix PHP code style | ||
id: codestyle | ||
continue-on-error: true | ||
run: ./vendor/squizlabs/php_codesniffer/bin/phpcbf . --standard=${{ github.workspace }}/phpcs.xml | ||
|
||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
token: ${{ secrets.GH_BOT_TOKEN }} | ||
commit-message: PHPCBF Auto Fix | ||
committer: Linchpin Bot <dev@linchpin.com> | ||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||
signoff: false | ||
branch: ${{ github.event.pull_request.head.ref }}-phpcbf | ||
delete-branch: true | ||
title: 'Auto Fix Formatting' | ||
body: | | ||
Update Formatting | ||
labels: | | ||
phpcs | ||
automated pr | ||
milestone: 1 | ||
draft: false | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
token: ${{ secrets.GH_BOT_TOKEN }} | ||
commit-message: PHPCBF Auto Fix | ||
committer: Linchpin Bot <dev@linchpin.com> | ||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||
signoff: false | ||
branch: ${{ github.event.pull_request.head.ref }}-phpcbf | ||
delete-branch: true | ||
title: 'Auto Fix Formatting' | ||
body: | | ||
Update Formatting | ||
labels: | | ||
phpcs | ||
automated pr | ||
milestone: 1 | ||
draft: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
on: | ||
pull_request: | ||
branches-ignore: | ||
# Do not run on auto submitted branches | ||
- '**-phpcbf' | ||
- 'dependabot/' | ||
- 'renovate/' | ||
paths: | ||
- '**.php' | ||
|
||
name: WordPress Coding Standards Inspections | ||
|
||
jobs: | ||
runPHPCSInspection: | ||
name: Run PHPCS inspection | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Run PHPCS inspection | ||
uses: rtCamp/action-phpcs-code-review@v2.1.0 | ||
env: | ||
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }} | ||
SKIP_FOLDERS: ".deployment,.github,assets,css,js,lib,sourcedata,wsdl,vendor" | ||
PHPCS_STANDARD_FILE_NAME: "phpcs.xml" | ||
with: | ||
args: "WordPress,WordPress-Core,WordPress-Extra" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
on: | ||
pull_request: | ||
branches-ignore: | ||
# Do not run on auto submitted branches | ||
- '**-phpcbf' | ||
- 'dependabot/' | ||
- 'renovate/' | ||
paths: | ||
- '**.php' | ||
|
||
name: PHP Lint | ||
|
||
jobs: | ||
php-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
coverage: none | ||
tools: cs2pr | ||
|
||
# Install dependencies and handle caching in one go. | ||
# @link https://github.com/marketplace/actions/install-composer-dependencies | ||
- name: Install Composer dependencies | ||
uses: "ramsey/composer-install@v2" | ||
|
||
- name: PHP Lint | ||
uses: overtrue/phplint@8.0 | ||
with: | ||
path: . |