2019-10-21 18:20:39 +02:00
|
|
|
name: Lint
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- 'src/scripts/**'
|
2019-10-22 23:20:40 +02:00
|
|
|
- package-lock.json
|
|
|
|
- '.browserslistrc'
|
2019-10-21 18:20:39 +02:00
|
|
|
|
|
|
|
jobs:
|
2019-10-23 10:32:25 +02:00
|
|
|
lint:
|
2019-10-21 18:20:39 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: 10
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm install --no-optional --no-audit --ignore-scripts
|
|
|
|
env:
|
|
|
|
CYPRESS_INSTALL_BINARY: 0
|
|
|
|
HUSKY_SKIP_INSTALL: true
|
|
|
|
|
|
|
|
- name: run eslint
|
2019-10-22 18:08:43 +02:00
|
|
|
run: |
|
2019-10-29 18:46:10 +01:00
|
|
|
CHANGED_JS=$(git --no-pager diff --name-only ..origin/master | grep '^src\/scripts\/.*\.js$' | xargs ls -d 2>/dev/null | paste -sd " " -)
|
2019-10-22 23:20:40 +02:00
|
|
|
if [[ -z $(sed -e 's/[[:space:]]*$//' <<<${CHANGED_JS}) ]]; then CHANGED_JS="src/scripts"; fi
|
2019-10-22 18:08:43 +02:00
|
|
|
echo $CHANGED_JS
|
|
|
|
node node_modules/eslint/bin/eslint.js $CHANGED_JS
|
2019-10-29 19:19:19 +01:00
|
|
|
|
|
|
|
- name: Lint JS bundle
|
|
|
|
run: |
|
|
|
|
npm run js:build
|
|
|
|
npx eslint --no-ignore ./public/assets/scripts/*.js
|