generated from figuren-theater/new-ft-module
-
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.
Enable automated JS & CSS checks (#56)
- Loading branch information
Showing
2 changed files
with
88 additions
and
2 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 |
---|---|---|
|
@@ -14,6 +14,8 @@ jobs: | |
changed-php: ${{ steps.filter.outputs.php }} | ||
changed-php_files: ${{ steps.filter.outputs.php_files }} | ||
changed-json: ${{ steps.filter.outputs.json }} | ||
changed-js: ${{ steps.filter.outputs.js }} | ||
changed-css: ${{ steps.filter.outputs.css }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
|
@@ -44,7 +46,8 @@ jobs: | |
- added|modified: '**/*.json' | ||
yml: | ||
- added|modified: '**/*.yml' | ||
scss: | ||
css: | ||
- added|modified: '**/*.css' | ||
- added|modified: '**/*.scss' | ||
php: | ||
- added|modified: '**/*.php' | ||
|
@@ -97,6 +100,89 @@ jobs: | |
|
||
#----------------------------------------------------------------------------------------------------------------------- | ||
|
||
lint-css: | ||
name: 'Lint: CSS' | ||
needs: pre-run | ||
# only run for changed .php files AND when it is a pull_request | ||
# because 'github.base_ref' will not be available on push | ||
if: needs.pre-run.outputs.changed-css == 'true' && github.base_ref != null | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected] | ||
with: | ||
# use the same version like WordPress/gutenberg | ||
node-version: '16' | ||
cache: npm | ||
|
||
- name: Install Node dependencies | ||
run: npm ci | ||
env: | ||
CI: true | ||
|
||
- name: Validate package.json | ||
run: npm run lint:pkg-json | ||
|
||
- name: Detect CSS coding standard violations | ||
run: npm run lint:css | ||
|
||
#----------------------------------------------------------------------------------------------------------------------- | ||
|
||
lint-js: | ||
name: 'Lint: JS' | ||
needs: pre-run | ||
# only run for changed .php files AND when it is a pull_request | ||
# because 'github.base_ref' will not be available on push | ||
if: needs.pre-run.outputs.changed-js == 'true' && github.base_ref != null | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected] | ||
with: | ||
# use the same version like WordPress/gutenberg | ||
node-version: '16' | ||
cache: npm | ||
|
||
- name: Install Node dependencies | ||
run: npm ci | ||
env: | ||
CI: true | ||
|
||
- name: Validate package.json | ||
run: npm run lint:pkg-json | ||
|
||
- name: Detect ESLint coding standard violations | ||
if: > | ||
github.event.pull_request.head.repo.fork == true || | ||
github.event.pull_request.user.login == 'dependabot[bot]' | ||
run: npm run lint:js | ||
|
||
- name: Generate ESLint coding standard violations report | ||
# Prevent generating the ESLint report if PR is from a fork or authored by Dependabot. | ||
if: > | ||
! ( github.event.pull_request.head.repo.fork == true || | ||
github.event.pull_request.user.login == 'dependabot[bot]' ) | ||
run: npm run lint:js:report | ||
continue-on-error: true | ||
|
||
- name: Annotate code linting results | ||
# The action cannot annotate the PR when run from a PR fork or was authored by Dependabot. | ||
if: > | ||
! ( github.event.pull_request.head.repo.fork == true || | ||
github.event.pull_request.user.login == 'dependabot[bot]' ) | ||
uses: ataylorme/[email protected] | ||
with: | ||
repo-token: '${{ secrets.BOT_TOKEN }}' | ||
report-json: 'lint-js-report.json' | ||
|
||
#----------------------------------------------------------------------------------------------------------------------- | ||
|
||
lint-php: | ||
name: 'Lint: PHP' | ||
needs: pre-run | ||
|
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