Github action to run eslint on only files that have changed in a pull request with support for excluding generated files.
...:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- name: Install
run: npm ci # OR: yarn
- name: Run eslint on changed files
uses: tj-actions/eslint-changed-files@v5.2
with:
config-path: "/path/to/.eslintrc"
ignore-path: "/path/to/.eslintignore"
extensions: "ts,tsx,js,jsx"
extra-args: "--max-warnings=0"
exclude-path: | # or a single string "generated.tsx"
generated.tsx
Input | type | required | default | description |
---|---|---|---|---|
token | string |
false |
${{ github.token }} |
GITHUB_TOKEN or a repo scoped Personal Access Token |
config-path | string |
false |
'.eslintrc' |
eslint configuration file |
ignore-path | string |
false |
'' |
eslint ignore file |
extensions | string[] |
false |
'ts,tsx,js,jsx' |
File extensions to run eslint against |
extra-args | string |
false |
'' |
Extra arguments passed to eslint |
exclude-path | string or string[] |
false |
'' |
A single path or a List of files to exclude entirely which match the listed extensions. |