forked from civicrm/org.civicrm.civicase
-
Notifications
You must be signed in to change notification settings - Fork 16
46 lines (33 loc) · 1.41 KB
/
linters.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Linters
on: pull_request
env:
GITHUB_BASE_REF: ${{ github.base_ref }}
jobs:
run-linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
- uses: actions/setup-node@v2
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Run npm install
run: npm i
- name: Fetch target branch
run: git fetch -n origin ${GITHUB_BASE_REF}
- name: Run phpcs linter
run: git diff --diff-filter=d origin/${GITHUB_BASE_REF} --name-only -- '*.php' | xargs -r ./bin/drupal/coder/vendor/bin/phpcs --standard=phpcs-ruleset.xml
- name: Run stylelint linter
#This step will always run regardless of previous step's status
#without if: ${{ always() }}, if the previous step is failure,
#the remaining step will not be executed.
if: ${{ always() }}
run: git diff --diff-filter=d origin/${GITHUB_BASE_REF} --name-only -- '*.scss' | xargs -r npx stylelint --config .stylelintrc
- name: Run htmlhint linter
if: ${{ always() }}
run: git diff --diff-filter=d origin/${GITHUB_BASE_REF} --name-only -- 'ang/**/*.html' | xargs -r npx htmlhint
- name: Run eslint linter
if: ${{ always() }}
run: git diff --diff-filter=d origin/${GITHUB_BASE_REF} --name-only -- '*.js' | xargs -r npx eslint --max-warnings=0 -c .eslintrc.json