Reputation: 571
I set up the following Github action:
name: Node.js CI
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install scraper dependencies
working-directory: ./scraper
run: npm ci
- name: Run linting in scraper
working-directory: ./scraper
run: npm run lint
The action run when the PR is created, but the checks are successful although eslint returns errors:
How can I make the action fail if there are errors from the linter?
Upvotes: 2
Views: 1893
Reputation: 5573
The problem is that the command invoked by npm run lint
is eslint . || true
. Because of this, the || true
is causing the command to always finish with success (exit code 0). By removing it, the exit code will be whatever eslint
returns, which is a nonzero exit code when there are errors.
Upvotes: 4