Merge pull request #763 from ezpaarse-project/americanphysio #278
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
name: Run linter on pull request | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '**.js' | |
- '!.lib/**' | |
pull_request: | |
branches: | |
- '*' | |
paths: | |
- '**.js' | |
- '!.lib/**' | |
env: | |
NODE_VERSION: '14' | |
jobs: | |
run-linter: | |
runs-on: ubuntu-latest | |
environment: development | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'npm' | |
cache-dependency-path: .lib/package-lock.json | |
- name: Make install | |
run: make install | |
- name: Get changed files | |
id: changed-parser | |
uses: tj-actions/changed-files@v35 | |
with: | |
files: | | |
**/*.js | |
- name: Run lint test | |
shell: bash | |
run: | | |
ROOT_DIR=$(git rev-parse --show-toplevel) | |
ESLINT="${ROOT_DIR}/.lib/node_modules/eslint/bin/eslint.js --ext .js --no-ignore" | |
JSFILES="" | |
for file in ${{ steps.changed-parser.outputs.all_modified_files }}; do | |
JSFILES="$JSFILES $file" | |
done | |
if [ -n "$JSFILES" ]; then | |
echo "$JSFILES" | xargs node $ESLINT | |
if [ $? -ne 0 ]; then exit 1; fi | |
fi |